Vera and Z-Wave.me Duwi Scene Controller workaround!

Something I’ve been meaning to tackle for a while is fixing the compatibility issues between my Z-Wave controller (MiCasaVerde Vera) and the Z-Wave.me Duwi based Scene Controllers.

z-wave vera 2
z-wave vera 2
z-wave scene controller
z-wave scene controller

I’ve had half a dozen or so of these in use with the Vera for a few years now (I am using the Everlux style), but out of the box the Vera only seemed to sporadically recognise a few of the 16 scenes that it is supposed to support.

It’s not clear where the problem actually lies, whether it’s with the Vera or the Z-Wave.me firmware – some people reported it working fine with the Vera 3 and Vera Lite – I’m currently using a Vera 2 and it definitely wasn’t working like it should!  I’d diagnosed the problem previously and found that the “sl_SceneActivated” parameter which should contain the correct scene number depending on which command was sent from the controller only ever seemed to switch between 0, 1 and 2.  I did discover though that “LastSceneID” parameter did seem to contain the correct scene number but that parameter came in 0.5 to 1 seconds later and wasn’t “wired up” to the scene “trigger” available in the Vera UI.  I knew I could probably work around the problem by adding some Luup code but at the time I only really needed to use the simple on / off function of the scene controller anyway, so I didn’t bother!

Roll forward to this week and I decided to re-visit the problem since I now needed to be able to trigger some additional scenes from the scene controller in the living room.  Currently it had only been used as a simple on / off (single click) for a standing lamp controlled by an Everspring AN157 plug module but now I could really do with being able to turn on / off the main light (controlled by a Fibaro FDG211) in the living room by double click.

So first off, a quick Google to see if MiCasaVerde / Z-Wave.me have officially fixed the problem…….and…..nope…..still not working properly (although again, some users report that it does work).  While a proper fix was still not available, I did stumble across the back end of this thread on the MiCasaVerde forum which seemed to suggest the way I’d originally envisaged working around the problem would indeed do the job.

So, here’s what I did:

1) Created several scenes in the Vera UI to do what I wanted (e.g. “Standing Lamp On”, “Standing Lamp Off”, “Main Light On”, “Main Light Off”). These scenes were just simple “actions”, they didn’t have any “triggers”, “schedules”, or other such logic. It was important to click “Save” in the Vera UI after doing this so that I could then go back into each scene and make a note of the “Scene Number”.

living room scenes
living room scenes
living room scene
living room scene
living room scene number
living room scene number

2) Created a “Scene Controller” scene in the Vera UI that had a trigger added for every possible scene number that the Z-Wave.me Scene Controller is supposed to support (e.g. 0 – 16). This meant that the “Scene Controller” scene would be called no matter what the “sl_SceneActivated” parameter mentioned above might contain.

living room scene controller triggers
living room scene controller triggers
living room scene controller trigger
living room scene controller trigger

3) Added the following Luup code to the “Scene Controller” scene:

luup.call_delay('scene_controller', 1)

function scene_controller()
  local lastSceneID= luup.variable_get("urn:micasaverde-com:serviceId:SceneController1", "LastSceneID", 19)if (lastSceneID== "1") then
    luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum="17" },0)
  elseif (lastSceneID== "2") then
    luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum="18" },0)
  elseif (lastSceneID== "11") then
    luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum="19" },0)
  elseif (lastSceneID== "12")  then
    luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{ SceneNum="20" },0)
end
end
living room scene controller luup
living room scene controller luup

Since the “Scene Controller” scene will now run no matter what the “sl_SceneActivated” parameter says, The Luup code calls the function “scene_controller” with a one second delay to allow for the fact that the “LastSceneID” parameter comes in up to one second later.  The function then gets the value of the parameter from the Z-Wave.me Scene Controller device number (“19” in this case) and runs the appropriate scene by it’s ID number (hence the need to note the scene number from the Vera UI earlier on).

All in all it works really well, even though it is a bit of a workaround!

Thanks for reading,

Martyn Wendon

Z-Wave Gateway VERA lite

Leave a Reply

Your email address will not be published. Required fields are marked *