Set an entity to the previous state?

Let’s say you have an automation to turn on the outside lights when motion is detected. After 5 minutes, you want to turn it back off. But if it was previously on then you want to set it to the previous state. What’s the best way to do that?

Using scenes, this is incredibly simple: https://www.home-assistant.io/integrations/scene/#creating-scenes-on-the-fly

Basically, capture the scene using the scene.create service, make your changes to the devices and then call scene.turn_on (passing the scene id you used in scene.create).

Great. Now we just need a scene.delete. Use scene.reload

1 Like

scene.reload and scene.turn_on are basically the same, as I understand it, but yeah, they both work.