Tip: Z-Wave.me switch

Hi,

I hope that my finding can help someone (or may be it is too obvious).

I had a constant problem with not seeing the immediate status of the wall switch (or dimmer) especially if it is directly associated with motion sensor or another switch/dimmer. Vera just does not see its status change. Despite of some switches (like mentioned in subj) have association groups to control devices, including Vera to these groups (by adding device #2) does not help to track the status at all (why???).
Here is my scenario: I needed to turn ON the light when door is opened if it is dark - that part was relatively easy. Now, it should work when someone comes home, but if someone leaves - it should not trigger the light. It wont happen if it is not dark enough but if it is dark there is a good chance that you already have your lights ON. Before you leave you usually manually turn it OFF.
So I needed to check if the light was recently manually turned OFF and in this case ignore the door opening. I asked on this forum about the solution but did not get any answer. To solve it I needed to either get time from the dimmer when it was turned off or get status from the switch with latest switching time. Switch works better since it proves that it was manual action.
I do know that z-wave.me switch has scene control functionality but I did not want to lose direct association between devices (the latency is already big enough). I’ve found a parameter on the switch which helped me with it despite of scenes are disabled there:

local switch_temp = luup.variable_get(“urn:micasaverde-com:serviceId:SceneController1”, “LastSceneTime”, 11)
if (os.time() - tonumber(switch_temp) > 15) then
return true
end

LastScene parameter gets updated instantly for some reason. The above script turns ON the light only if the switch was triggered more than 15 seconds ago.

Regards.

Change:

if (os.time() - tonumber(switch_temp) > 15) then
    return true
end

to:

return os.time() - tonumber(switch_temp) > 15