Home/Away Automation

I have a Sonoff NSPanel by my front door and I’m planning to have this automate the turning off of all the lights, setting alarm etc. However, I want to have it store what was previously on, and turn it back on when I get home… How would you recommend doing this?

My NSPanel is flashed with ESPHome and is working well if I just want to add individual lights etc.

I have enormous number of lights, lamps, so don’t want to select each one from a dropdown - I’d be there for a day doing this.

I think I could get a template to work through all lights and get their state, then save this (maybe) but not sure if I can update the state of a light using a template.

Automation looks like it needs to have a trigger, but I want this to be called only when I press a button on the NSPanel.

If I try create a script, it looks like I have to select every entity manually…

Cheers
Craig

I think you can do this with scenes.

What you do is create an automation that triggers when you leave your house, with call service → scene create and use all the lights that you want to return to their previous states. Add an action to turn of the lights after the scene is created.

Then you need another automation that will apply the scene that was created when you left.

Hope this helps
Kind Regards

1 Like

thanks! will do some digging