Author Topic: HowTo: Aeon Labs MiniMote fully functional Scene Controller in UI5!  (Read 67827 times)

Offline jjwatmyself

  • Jr. Member
  • **
  • Posts: 73
  • Karma: +0/-0
Re: HowTo: Aeon Labs MiniMote fully functional Scene Controller in UI5!
« Reply #150 on: June 05, 2016, 10:59:48 am »
I'm using a Vera 2 on UI5 version 1.5.673 and Minimote Firmware 1.19 (US)

Credits to
jasondag http://forum.micasaverde.com/index.php/topic,29493.msg241697.html#msg241697
cpmilaz http://forum.micasaverde.com/index.php/topic,29493.msg218577.html#msg218577
pmnb http://forum.micasaverde.com/index.php/topic,29493.msg278848.html#msg278848

To summarize "LastSceneID" is the only value being set correctly and modification are required to have use of all buttons.  You'll need a new .json and .xml file.

CAUTION: Do not overlay existing files.  The process below results in new .json and .xml files on your Vera 2.  The steps for UI7 do not require the use of the .xml file. The .json files for UI5 and UI7 ARE NOT THE SAME, DO NOT MIX AND MATCH!!

Step by step:
1. From UI5 Goto APPS
2. Click Develop apps
3. Click Luup Files
4. Download "D_SceneController1.json", and save as "D_SceneControllerAeonMinimote.json"
5. On your PC, edit and change "sl_SceneActivated", to "LastSceneID"
6. Download "D_SceneController1.xml", and save as "D_SceneControllerAeonMinimote.xml"
7. On your PC, edit and change "D_SceneController1.json", to "D_SceneControllerAeonMinimote.json" (fixed typo Jan 8 2017)
8. On UI5 upload files and check/tick reload luup engine.
9. Goto the device page and choose advanced options
10. Set 'device_file' to "D_SceneControllerAeonMinimote.xml"
11. Change NumButtons from 4 to 8 (you will now ignore the Deactivate buttons 1-8 after changing this)
12. Change PollSettings to 0 (because the Minimote never wakes up)
13. Go to Device Options, add configuration settings, Variable=250 Data size=1 byte Dec, Desired Value=1

To configure scenes:
1. On UI5 goto the device page and choose Scenes
2. Activate Scenes Button #1,3,5,7 are Short Press for Minimote buttons 1,2,3,4
3. Activate Scenes Button #2,4,6,8 are Long Press for Minimote buttons 1,2,3,4
(Ignore all Deactivate Scenes 1-8)

Here are a scene that is useful for thermostats that support heat and cool to set temp based on what mode the thermostat is currently set to.  In my experience, during the summer, houses run warmer and in the winter houses run cooler.  Having a single button that when pressed will set the comfortable temp is nice.  I have this scene set for a short press and ESM set to a long press on same button.

Code: [Select]
local DevID_Therm = 11
local EnvStatus = luup.variable_get("urn:upnp-org:serviceId:HVAC_UserOperatingMode1", "ModeStatus", DevID_Therm)

luup.call_action("urn:upnp-org:serviceId:HVAC_UserOperatingMode1",
                   "SetEnergyModeTarget", {NewModeTarget = "Normal"},DevID_Therm)

if (EnvStatus == "CoolOn") then
   luup.call_action("urn:upnp-org:serviceId:TemperatureSetpoint1_Cool",
                   "SetCurrentSetpoint", {NewCurrentSetpoint = "74"},DevID_Therm)
elseif (EnvStatus == "HeatOn") then
   luup.call_action("urn:upnp-org:serviceId:TemperatureSetpoint1_Heat",
                   "SetCurrentSetpoint", {NewCurrentSetpoint = "68"},DevID_Therm)
end


# Scene 2:
local DevID_Therm = 11

luup.call_action("urn:upnp-org:serviceId:HVAC_UserOperatingMode1",
                   "SetEnergyModeTarget", {NewModeTarget = "EnergySavingsMode"},DevID_Therm)

Enjoy!!
« Last Edit: January 08, 2017, 06:18:10 pm by jjwatmyself »

Offline Gogzy

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-1
Re: HowTo: Aeon Labs MiniMote fully functional Scene Controller in UI5!
« Reply #151 on: December 28, 2016, 09:13:49 am »
Hello all,

I would like to know is it possible to have the minimote or any other remote to use as a remote from a car?
I have the Vera Plus and UI7 latest firmware. I allways use the phone to change the mode (home/away), but that is not so practical. So can i use minimote to do that?
I dont know what will happen when the minimote iout of range is and then again in range? Does it work automaticaly? Can i just switch mode when i am in range of the Vera? Or do i need to include it every time i get in range again?

Thanks a lot



Offline shallowearth

  • Hero Member
  • *****
  • Posts: 890
  • Karma: +41/-9
Re: HowTo: Aeon Labs MiniMote fully functional Scene Controller in UI5!
« Reply #152 on: December 28, 2016, 10:37:31 am »
If you set polling of the minimote to 0, you can take it out of range and bring it back in range, and you should be fine

Offline jjwatmyself

  • Jr. Member
  • **
  • Posts: 73
  • Karma: +0/-0
Re: HowTo: Aeon Labs MiniMote fully functional Scene Controller in UI5!
« Reply #153 on: January 08, 2017, 01:04:50 pm »
Hello all,

I would like to know is it possible to have the minimote or any other remote to use as a remote from a car?
I have the Vera Plus and UI7 latest firmware. I allways use the phone to change the mode (home/away), but that is not so practical. So can i use minimote to do that?
I dont know what will happen when the minimote iout of range is and then again in range? Does it work automaticaly? Can i just switch mode when i am in range of the Vera? Or do i need to include it every time i get in range again?

Thanks a lot

If your phone is on Wifi and you have AnyMote Smart Remote installed on your phone, you can program HTTP GET Buttons and activate any Vera scene. I used the Notifications feature on this app in order to display buttons permanently on my Android pull down and lock screen. Turn on screen, press button. Done.  This gives you a very convenient scene controller on the Android lock screen with up to 15 buttons. Personally I use the Anymote Notifications feature for IR and have some Vera scenes on the remotes within the app. But I like your idea about doing things from the car with easy to access buttons.  That would save me from opening Home Buddy!  :D

Here is the HTTP GET URL.  Just change the scene umber on the end.

http://IP:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=15


Offline dannieboiz

  • Sr. Member
  • ****
  • Posts: 380
  • Karma: +1/-2
Re: HowTo: Aeon Labs MiniMote fully functional Scene Controller in UI5!
« Reply #154 on: May 31, 2017, 12:37:41 am »
Played with the Minimote (MM) a bit over the weekend to look into options related to controlling dimmers.

By default the MM acts as a scene controller, triggering 4x2 scenes in Vera, losing the ability to change the level of a dimmer from the MM, as previously discussed. There are some workarounds.

Experimental / Beta
Given this uses poorly or un-documented low-level Z-Wave commands and features, and has some delays that may be device dependent, we'll need to see how well the stuff below works for folks. It was tested with a Leviton and a GE plug-in dimmer. 

Method A - Make it a regular secondary controller
Put the following in the Luup sandbox (Apps > Develop Apps > Test Luup code (Lua)):

Code: [Select]
luup.call_action('urn:micasaverde-com:serviceId:ZWaveNetwork1','SendData',{Node='<nodeID>',Data='x70 4 250 1 0'},1)(Replace <nodeID> with the nodeID of the MM; this is what is shown on the MM's Settings tab as ID (not Device #).)

Then, while holding the top left button on the MM, click the Go button on the Dashboard.
(The SendData command does not get put on the Wake-Up queue; hence the clunky method to keep the MM awake by holding a button and then sending the command.)

This now controls dimmers the same way as when the MM is primary.

Notes:
Having the MM control the lights directly is nice, but because Vera isn't in the loop, the status of the dimmer is not updated in Vera until the next poll. So make sure to enable polling for any devices controlled by the MM that support instant status updates (e.g. Leviton), as by default Vera does not poll these devices. Also, for faster updates, you could write a scene on a periodic timer that polls all devices controlled by the MM, and see how it performs.

This method is easy to enable and may suffice if only controlling some lighting devices. If you also want the scene capability in Vera to do more complex things (with some of the buttons), then consider Method B.


To get back to the scene mode Vera normally configures the MM in (and required for Method B):
Code: [Select]
luup.call_action('urn:micasaverde-com:serviceId:ZWaveNetwork1','SendData',{Node='<nodeID>',Data='x70 4 250 1 1'},1)


Method B - Write scenes to control dimming
Write 2 scenes per button. One for activated and one for de-activated. Besides the appropriate trigger, put the following under the scene's Luup tab:

A scene is activated:
Code: [Select]
local DIMMER_DEVID    = <dimmerDevID>
local DIMMER_NODEID   = <dimmerNodeID>
local DIMMER_ON_VALUE = <dimmerOnValue>
local MINIMOTE_BUTTON = <mmButton>
local MINIMOTE_DEVID  = <mmDevID>
local DIMMING_TIMEOUT = 4
local POLL_HOLDOFF    = 3

local SC1_SID = 'urn:micasaverde-com:serviceId:SceneController1'
local ZN1_SID = 'urn:micasaverde-com:serviceId:ZWaveNetwork1'
local HD1_SID = 'urn:micasaverde-com:serviceId:HaDevice1'
local D1_SID  = 'urn:upnp-org:serviceId:Dimming1'

local lastSceneTime        = luup.variable_get(SC1_SID,'LastSceneTime', MINIMOTE_DEVID) or os.time()
local lastSceneDeactivated = luup.variable_get(SC1_SID,'sl_SceneDeactivated', MINIMOTE_DEVID) or 0
local loadLevelStatus      = luup.variable_get(D1_SID,'LoadLevelStatus', DIMMER_DEVID)

lastSceneTime        = tonumber(lastSceneTime)
lastSceneDeactivated = tonumber(lastSceneDeactivated)
loadLevelStatus      = tonumber(loadLevelStatus)

if ((os.difftime(os.time(),lastSceneTime) < DIMMING_TIMEOUT) and (lastSceneDeactivated == MINIMOTE_BUTTON)) then
  luup.call_action(ZN1_SID,'SendData',{Node=''..DIMMER_NODEID..'',Data='x26 5'},1)
  luup.call_action(HD1_SID,'Poll',{},DIMMER_DEVID)
  return true
else
  if (loadLevelStatus > 0) then
    luup.call_action(ZN1_SID,'SendData',{Node=''..DIMMER_NODEID..'',Data='x20 1 0'},1)
  else
    luup.call_action(ZN1_SID,'SendData',{Node=''..DIMMER_NODEID..'',Data='x20 1 '..DIMMER_ON_VALUE..''},1)
  end
  luup.sleep(1000*POLL_HOLDOFF)
  luup.call_action(HD1_SID,'Poll',{},DIMMER_DEVID)
  return true
end
Replace the following in the first 5 lines:
<dimmerDevID> with the Device# from the dimmer's Settings tab.
<dimmerNodeID> with the ID from the dimmer's Settings tab.
<dimmerOnValue> with the level the dimmer should be set to (1-100, 255=previous).
<mmButton> with the number of the MM's button (1-4).
<mmDevID> with the Device# from the MM's Settings tab.


A scene is de-activated:
Code: [Select]
local DIMMER_DEVID    = <dimmerDevID>
local DIMMER_NODEID   = <dimmerNodeID>
local DIM_THRESHOLD   = 50

local ZN1_SID = 'urn:micasaverde-com:serviceId:ZWaveNetwork1'
local D1_SID  = 'urn:upnp-org:serviceId:Dimming1'

local loadLevelTarget = luup.variable_get(D1_SID,'LoadLevelTarget',DIMMER_DEVID)

loadLevelTarget = tonumber(loadLevelTarget)

if (loadLevelTarget >= DIM_THRESHOLD) then
  luup.call_action(ZN1_SID,'SendData',{Node=''..DIMMER_NODEID..'',Data='x26 4 x78 99'},1)
  luup.variable_set(D1_SID,'LoadLevelTarget','1',DIMMER_DEVID)
else
  luup.call_action(ZN1_SID,'SendData',{Node=''..DIMMER_NODEID..'',Data='x26 4 x38 1'},1)
  luup.variable_set(D1_SID,'LoadLevelTarget','100',DIMMER_DEVID)
end

return true
Replace the following in the first 2 lines:
<dimmerDevID> with the Device# from the dimmer's Settings tab.
<dimmerNodeID> with the ID from the dimmer's Settings tab.


A short press of the button should now toggle the dimmer on or off. When turned on, it will be set at the provisioned level (DIMMER_ON_VALUE); you can use 255 to 'go-to-previous'.

A long press of the button will start ramping up or down. The press only kicks it off, letting go of the button doesn't stop it; to stop the ramping do a short press.

A poll is done after all state changes, so the status in Vera should update.

Notes:
Because the short press double as on/off and stop action, you can not go to the off state immediately after changing the level; there is a time-out, currently set at 4 seconds.

Also, the poll after on/off is done with a delay, currently set at 3 seconds, to give the dimmer time to ramp up/down to the final state; otherwise the wrong value will be polled.

So when testing this, keep the slightly altered button behavior and the time-outs/delays in mind.



Method C - Program buttons to send any command
The MM allows the buttons to emit any sequence of bytes to any group of nodes, making it a very customizable device. This could be leveraged, however there appear to be only 2 events per button, so combining on/off and dimming with just 1 button may not be possibe. Given that, plus the complexity to get it set up, as well as the partial implementation of some of the command classes, making it a one-time-only/first-time-right kind of exercise, I decided to consider this method out-of-scope.

Just got my minimotes, I setup 2 scenes, one for turning off a light and and one for turning on, assigning them to button 1 and 2.

I'm trying to figure out how to get Method A to work in the above workaround to be able to also control the dim level but I'm not quite sure exactly what steps follow. I did the LUA code with my node ID, and got a confirmation that the message was sent, then my remote no longer send the commands until I did the revert code in the above steps. Was there additional steps to make the dimmer work properly? Ultimately what I'd like to do is button 1 is off with short press and long press lower the light and the same thing for button 2, short press on, long press up the light. Or really any method that provides me the ability to turn on/off and dim the lights.