When I have Home Assistant activate a scene that turns on a group of lights, and one of those lights is unavailable (no power, etc...) and that light becomes available at some later point in time again, I would like Home Assistant to turn on/off the light that became available again to what it was set to while it was unavailable by the scene.
I thought about making an automation: if a light switched its state from unavailable to anything else, read out the current state that it is supposed to be on right now and apply it to the light.
The problem with that is: I would have to copy-paste that automation for every light in my home that can become unavailable. I feel like there is a smarter way to do this.
Any ideas?