Set item status to last state on reboot/recover from power failure

I’m trying to figure out a way to set certain items status back to what they were prior to rebooting or boot after a power failure. I’m using the generic alarm with my DIY network of door and window sensors.

Can someone tell me how to do this? I’m assuming that an automation can be triggered based on startup and that the last known values from the sensors can be pulled from the history/database and then sent to the items? Is there an easy way to do this?

A new component is under development, that will make this much easier:

Thanks for pointing me to this. It definitely looks exactly like what I’m looking for.

I’m new to HASS. Any ideas on how long it will take before this will make it to a release? I see things about passing checks and all but don’t know what that means in regards to getting released.