I’m using a modified version of the SmartThings demo app: Double Tap. This lets me give extended functionality to a switch by running a specific set of instructions when a switch is double taped on or off.
In my situation what I’ve got is setup a switch at my back door that when it is double tapped it opens my garage door. But there’s an undesirable side effect… the light that this switch controls goes on. This isn’t terribly surprising of course… I have pushing the button on after all. And it isn’t too hard to take care of… I simply insert a command in the code to turn off the light.
But, there’s a problem with that solution: What if the light was already on? I don’t want to turn this light off if it was on already. (This isn’t a huge problem for this particular setup, but if I use this in other areas it could be a bigger deal.)
What I ideally need to do is find out what the state of the light was just before I double tapped the switch and then either leave the light on or turn it off. But how do I determine what the state was before I pushed the switch?