Sonoff power on state vs switch

Hello Guys,

I thing this is a simple question which already use sonoff but for me is that to difficult.

What i have;

  • Sonoff mini with tasomta -> connected on the Ceiling and the bulb connected to sonoff mini.
  • I have a normal wall Switch.

Question: I need, when i use the normal switch and turn on, i will always that the bulp turn on wherever it is turned OFF via Home Assistant.

It is now so when i turned off the sonoff via Home Assistant and turn on via normal wall switch the bulb will go on and after 4 seconds it is gooing off.

Current config file"

platform: mqtt
name: “xxx”
state_topic: “stat/xxx/POWER”
command_topic: “cmnd/xxx/POWER”
qos: 0
optimistic: false
payload_on: “ON”
payload_off: “OFF”
payload_available: “Online”
payload_not_available: “Offline”
retain: true

Just needed:

1. Via normal wall switch bulbs always be turned ON by turning on the Wall switch.
2. Update the status on Home Assistant as bulp “turned off” when turned off via wall switch.

Here is the culprit :

retain: true

And it is not easy to get rid of it. Best way is to install MQTT Explorer and delete the retained message there.

Do i need to do something on tasmota console such as PowerOnState.

It is now set on 1.

PowerOnstate is not important in this case. That is the state when power is cut and then restored.

In this case when swtiched off the wall switch the power off will cut off because the Sonoff is installed on the ceiling. Just sholud be now more difficult in my case :woozy_face:

Just also i must now set to Retain: false after deleted that via MQTT explorer?

Retain: off or simply delete the retain flag.

I don’t know how you wired the mini, but if you connected the wall switch to s1 and S2, the power is not cut off when you switch the switch.