I want to trigger my “Away” scene with a double-tap on my Leviton VRMX1 dimmer switch at my front door.
I can do this today, poorly, with a timed counter in a scene triggered by On/Off state change:
function RstEntryTaps(stuff)
entryTaps = 0
end
if not entryTaps then entryTaps = 0 end
entryTaps = entryTaps + 1
luup.call_timer("RstEntryTaps", 1, "10", "", "")
return (entryTaps == 2)
Except, for this to trigger, I have to wait for the light to dim completely after pressing it, before pressing it a second time. The event doesn’t fire until the dimmer transition is complete. If I “jump the gun” and press it a second time before it’s completed the first, no event is fired. The same issue arises when using this code in a plug-in:
luup.variable_watch("myfunc", "urn:upnp-org:serviceId:SwitchPower1", "Status", DEVICE_NUM)
-- or
luup.variable_watch("myfunc", "urn:upnp-org:serviceId:Dimming1", "LoadLevelStatus", DEVICE_NUM)
However, one of the reasons I purchased the Leviton dimmers is because they support “Instant Status”. I’d hoped to not have signalling delays like this. Is there a way to know (nearly) the moment the button is pressed?