I’m wanting to create a variable that increments up +1 each time a sensor in the room is activated, and then decreases -1 each time it is deactivated. Then I want to use the value of this variable to control the lights. e.g.
Lights turn on if variable is above 0
Lights turn off if variable = 0
I’m just not sure how to create this variable. It would only need to hold the values 0 to 5. Seems like such a simple thing to implement I just can’t think how to do it! Any help much appreciated.
Thanks for your responses. I’ve made a bit of progress but can’t get it working as I’d like. I set up an input_slider and I’m trying to set the value +1 / -1 depending on the value of my motion sensor. This is what I have so far. The increment up worked once but then it stopped working. No idea why it worked. Any pointers welcome!
On Vera, there was a handy plugin called “variable container”. It basically just gave you 4 empty locations to store and access strings. It’d be handy to have a similar object in HA that had actions to set, concatenate, retrieve and clear. I’ll create a feature request.