I’m trying to solve a challenge related to controlling the on/off state of smart lights (home control) and would love to get thoughts and advice please…
I have programmed one of the Harmony light switch buttons (bottom left on the remote) so that when short-pressed it turns on a Virtual Switch in SmartThings and when long-pressed it turns off the same Virtual Switch. Then in SmartThings I use webCore I take a certain action based on whether the switch was toggled on or off.
That all works perfectly fine, except there is one significant issue… Harmony apparently keeps track of the status of whether the light switch it is on or off (and assumes only this one switch can change the on/off state), and will not send an On command if it thinks it is already On, and will not send an Off if it thinks it is already Off. For instance let’s say the switch is in the Off position and the lights are really off. I short-press for On and Harmony sends the On command as it should and all works well.
But here’s where the issue comes in… I have other ways to turn this switch on and off outside of Harmony. For instance via Alexa and a push button home control / SmartThing button on a wall (not a physical switch). So let’s say the lights are on, and I now use Alexa to send a voice command and tell it to turn off the lights, and it does. So far so good. But at this point, Harmony thinks the lights are still on, even though they are off, because all it knows is that the last time it’s button was pushed was to turn them on. So a little later I then want to turn the lights on. If I short-press the light button on the remote, nothing happens! This is because Harmony has outsmarted itself. It thinks “oh they said to turn the lights on, but they are already on, so I won’t send any command.” And the lights stay off. The only way to get the button working then is to long-press it so that it sends a Off command, thinking it just turned the lights off, even though this actually did nothing since they were already off. And then a few seconds later I can short-press the light switch button, and then it sends the On command and the lights come back on.
Likewise I have the same exact issue in reverse - if I turn the lights on with Alexa or some other automation, Harmony things the lights are off, so when I then long press the button it doesn’t send an off command, so I then have to short-press to send a On command, which effectively does nothing since the lights are already on, then a few seconds later I can long-press and it sends and Off command and the lights go off.
I’d love to find a solution so that Harmony is not tracking the “state” of the on/off (or a way for me to programmaticly change its state) and if I short-press it always sends an On and if I long-press it always sends an Off. This would solve the issue 100%. However I don’t think there’s a way to get Harmony not to track the state. In which case I’m wondering what a possible workaround would be. The current workaround (aka short-pressing for On when lights are already on and then long-pressing for Off to get them off, and vice-versa) is pretty annoying. Is there some sort of trick or better technique?
Edit: Just to be clear, my goal is to continue to be able to use the same light switch buttons (bottom left) on the remote to turn the lights on and off. So any technique that requires me to use another means besides these buttons will not solve the challenge.