I tried to find an answer into the community but I cannot find it. I have some mqtt switch switch devices connected to HA, my setup is working fine, but when the devices reboots (power outage) they took a default state (off).
I would like that HA act as a master, when it see that the state changed of a managed device it automatically set it again to the state saved in HA (if it was on I would like to have on again or viceversa). Like if HA has the priority to these devices.
I think that is feasible with variables etc, but I would like to know if there is a simple way to do that.
The devices are some camera with switches (https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/) it seems that the firmware doesn’t download the state from mqtt at the startup, it just set again the switch from a default state.
@myle your case is when HA start, I would like that action when the device restart.