I would like to do something seemingly simple using my inovelli zwave dimmers, which are both switches and button controllers:
If the light is off, and I push the down button once, then turn the light on at a low level.
If the light is on at less than full brightness, and I push the up button once, turn it on to full brightness.
The problem is that due to latency in the button controller app, by the time the hub processes the CentralSceneNotification from the down button being pushed, the switch has already changed its state to off (regardless of whether it was on or not beforehand), so the "switch is off" condition is always true, regardless of whether it was turned off a minute or a millisecond ago.
This is something I'm going to want to apply to all of my dimmers, and as a software developer I'm allergic to repetitive clicking in a UI to accomplish the same thing to multiple targets, so once I've figured out a solution I'll probably write it as an app.
I'm having a hard time coming up with a good way to solve this simple-to-describe request, though. It seems like the basic issue is that the device sends both a SwitchMultilevelReport (which updates the level in the device handler) and a CentralSceneNotification (which triggers the button controller) , and that there is no guarantee of the order of those events.
As you my know, turning the load on or off is (usually) done by the switch/dimmer itself. This is not a function of the hub. However, some Z-Wave switches and dimmers, these included, let you disable local control (equivalently: enable local protection) so that physical taps do not do this. As long as you don't also disable remote (Z-Wave) control, you can still use the hub to turn the device itself on or off in response the scene/button events.
This--disabling local control--might be the only way you can get what you want. It has the disadvantage of needed the hub for even basic on/off control, which might make this approach lose some "acceptance factor" points. However, it's easy to re-enable these on the device if needed (tap the config button 8x to toggle the setting)--no hub needed. And hopefully the need will just never arise.
Perhaps others will have other ideas. If it were me, I'd probably just use double taps or something to avoid this complication entirely. Between that and the config button, there's no shortage of posible actions on these things.
Thanks for the idea, but I think that the downsides outweigh the upsides of that approach. Low latency and high reliability are more important than adding this feature.
I kind of think that what I really need is a way to check "the state of the switch 1 second ago"
You can sort of do that: you could trigger on "switch: on" in Rule Machine, do a wait for event (the button/scene event) with a 1 second timeout or whatnot, then do your desired action if it wasn't the timeoit (RM has a way to check this), i.e., if it was the button event. If your switch ever reports events in the opposite order (switch vs. button), this might get hard to work with, but I'm not sure I've seen that with mine.