How to create a Memory Sensor variable

I have an issue with my motion sensor in my office where I sit still for too long and then the lights turn out. The only way to combat this using the Hue app is to set a longer time-out but then you end up with your lights staying on for longer after leaving the room which isn’t ideal.
Therefore I want to create an automation that overrides my hue motion sensor and keeps the lights on when a smart plug is on, but once the plug is off control is handed back to the motion sensor.

To achieve this I think I need to create some sort of variable that holds a 0 or 1 value. The logic being:

  • Set my motion sensor to only operate when the variable has a value of 0
  • I turn my smart plug on and it turns on the lights and sets the variable to 1, therein bypassing the motion sensor
  • When I turn my smart plug off it sets the variable back to 0, thus giving light control back to the motion sensor.

Anyway I’m sure this can’t be that hard but I’m a total HA noob and can’t figure out how to achieve this. Any help appreciated!

Sounds like you are looking for an input boolean - they come in real handy for storing on/off type of things for later use in an automation.

1 Like

I don’t think you need memory variable for this. I would use two condition automation.

if plug is off and no motion for x time then shut off light.

1 Like