Power-up default states for smart bulbs, power switches, etc

I have a number of sensors, switches, smart bulbs connected to my WebThings gateway. After a short power outage, all the smartbulbs defaulted to ‘on’, which are normally triggered by a motion sensor or a time-of-day rule. Is there a way to set a power-on default for smart bulbs, switches, etc. so that the IoT gateway can reset everything to their default at power-up? Another scenario is where the gateway has a backup power but not the IoT devices (e.g. the smart bulbs). Is there a way for the gateway to detect that a device went offline, then back online and thus reset it to its default state (or to its last known state)?

This is typically a function of the individual devices. The problem with the gateway detecting power outages is that the gateway itself would have also lost power. You could probably come up with some convoluted rule (or set of rules) to try to detect that state, though.

Thanks Michael. I am using Ilumin bulbs from Inovelli, and they tend to turn on upon a power cycle. Perhaps what is needed is a rule that uses a ‘presence detect’ capability and detects the transition from false to true, which can then trigger the setting of each device to a a default state. This would cover both the “gateway lost power” and “device lost power” cases. I saw a ‘network presence detector’ add-on. I will check and see if that might do the trick.
Update: ‘network presence detection’ add-on is strictly for WiFi devices. Need a more generic presence detection add-on or built-in function.