Running HA on my RPi3 with MQTT devices (switches, sensors)
Have currently one issue!
switch/light status is always in the “ON” state after HA restart (or RPi3 restart).
Switching the light on the wall (changing the state of the lights) is reported back to HA fine just after every restart the light status (toggle switch) shows “ON” even if the light is “OFF”
The issue is that if the light is ON and the switch looses power (its set to be OFF when the power comes back) HA did not get a OFF massage and the state stay’s ON and it switches the light ON
Looks like you’re using a sonoff? does it not send an mqtt command when it regains power?
The other option is to comment out the state_topic, but then you won’t have the state recorded like the switch…
Sounds a bit strange, so it definitely when home assistant starts it turns the sonoff on?
I ask because there is a setting in the sonoff about if you want it to retain its last state and also if you want it to turn on or off after a power cycle.