Ive configured HA to working with sonoff via mqtt.
I can turn the light on or off via the HA power toggle. When i turn the power off ( via the regular wall switch ) HA dosent change the light toggle state to off. (Sonoff is powered off and not communicate with HA)
There is a way that HA will know if sonoff is powered off and change the power toggle?
When your sonoff connects to the broker it can set a will. When the broker detects the sonoff has disconnected (such as when powered off), it will publish the will to clients that subscribe. If the will is the same as the “off” message, HA will show the switch as off.