Im struggling with my partner, who keeps switching the sonoff controlled lights off at the wall light switch.
What I would like to achieve is that if a device has been switched off by home assistant, when the power is manually turned off, then back on, the light is turned ‘on’ (ie giving my Luddite partner the option to turn the light on manually at the wall) . I have achieved this by setting PowerOnState in the Configuration to ‘Turn relay on after power on’. The light goes on, but after 10 seconds (after connecting to the MQTT Client) it is turned off (to its previous last state). I suspect this is something to do with the LWT, but don’t know how to disable this action.
As an aside, I have set retain: false in my configuration file.
I am using the embedded MQTT Broker on my Raspberry Pi
Thanks
Connect the light switch to one of the sonoff gpios instead of using it to cut power to the sonoff. Set that gpio as a switch in the sonoff module config web page.
Then use the console web page to issue the following commands:
Switchmode1 0
Switchtopic1 1
You will be able to then control the sonoff from both the switch and HA.
That would have been perfect if there were space to get a sonoff behind the light switch in the wall. There isn’t , so the sonoff is in the ceiling rose, and the wall is quite thin (internal), and I think I would end up coming physically out into the next room if i made it any deeper. - I will probably end up trying this in other places in the house where there is an external wall though.
Nothing I can do to stop Home Assistant sending a new request to set the state back to off once the device has rebooted?: