it would be nice to have the possibility to set a configuration whereby the previous state of a switch or light is restored when the power returns
I don’t think I have any switches or lights that does not restore it’s state.
Sensors yes but not switches and lights.
This is probably a integration issue
This is best handled by the firmware of the device itself. I have some TP-Link smart bulbs that don’t have this: They always turn on after a power failure. Shelly bulbs are versatile and you have many options (I have a few of those too). For the TP-Link bulbs I have an input boolean that gets updated whenever that corresponding bulb’s state changes (on and off states). And then you need a separate sensor to monitor your power feed and an automation to restore that state when needed.
all tuya bulbs and switches do not have this option, and also zigbee sonoffs installed via zha and not with ewelink app. There are so many devices without this option in the firmware and implementing boolean inputs for each and automation for each is boring. it would be nice to have an HA function to do this