It took me a while to handle this with Rule Machine and global variables. Each of my rooms has a global variable that defines it's current state. I am able to detect power failures by using a Sengled classic bulb that turns on when power is restored. When that happens I re-enumerate though my room rules to make sure the last set scene is re-applied. I have a 5 minute delay after I detect the bulb has come on before I execute it. After the reset I then command that bulb to turn off.
One more thing is that I have my Hubitat on a UPS that is also protecting my router and internet gateway which gives it some survivability during the power failure. I have enough battery for 35 minutes of run before I force the shutdowns on the equipment.
My old X-10 controller called a Stargate had what was called powerfail catchup. It was a really cool feature where it would checkpoint when power failed, used it's current state table for the devices and send that out after power was restored and then fast forward though any time based rules to execute any automations. It was really cool to watch it in action.
If I had time I would try to code something like this for Hubitat.