When saving a scene, if a light is off then that’s the only thing that gets saved. If you then turn the light on and change it’s color for example, then restore the scene then it’ll only turn the light off, it won’t first restore the color to the previous state since it was never saved.
I believe that’s because off entities don’t expose things like color and therefore can’t be saved.
The workaround is to have the automation save the scene as is, then turn on all the lights and save another scene with them all on, then do whatever you need then restore the scenes in reverse order.
It’d be great if HA could just have scenes save all attributes of the entities, including hidden ones, or at the very least had a built-in way to to do that two step save / restore.
In case it’s not clear - the first scene saves the on / off state while the second scene saves attributes like color. You restore them in reverse order because color cannot be set on an off light, so you restore the “color scene” first, then the on / off scene second to get back to the actual “before” state for all the entities. I just wish this could be done with one save / restore, or through a specialized action if that makes more sense.
They do, that’s the problem. For example take an automation to blink a light red :
The light is off
save the scene
Turn on the light red, apply a blink effect or do a loop
Restore the scene
The light is off again, but next time you turn it on it’ll be red, not whatever color it was when you saved the scene. Scene saving does not save anything for entities that are not on during the save call, forcing you to use two scenes : one for the on / off state and one for the extra attributes only visible when it’s on
I also ran into this issue with an automation that is used to call everyone when dinner is ready using lights in the rooms.
When the automation is triggered, it creates a scene of all the lights that will be used to restore their state after the automation is done.
It seems to work fine on the first attempt if the lights are turned off, but if you then run the automation again without having turned on/off the light in the meantime, it fails to do the restore properly afterwards. It just turns blue, which is the color it goes to during the automation to notify people.
Oh, so that’s probably why saving wled preset sometimes works on restore and sometimes does not work for me .
So yeah, it would be great to be able to do snapshot of all entites affected by scene A to another scene B (for example?) so it could be restored later by calling this scene B
You intuition here is right. Home Assistant isn’t storing the previous state, but rather getting the status from the device itself. If the device is off, it isn’t reporting the state. Some vendors (like Inovelli) do provide information as to the previous state of the device via attributes.