I want to create an script which will remember for each area in my apartment current lights that are on/off (current scene) and if motion detector detects that nobody in a room, turn off lights.
When someone enters in that room within less than 5 minutes setup lights as was
Is it doable? Im looking for some clean solution for templating maybe area and for each area to get all the lights entities and states, and put it into service scene.create, and the trigger would be motion detection -> cleared