How to use Sonoff Tasmota in Home Assistant?

Hello all.

Just starting with Home Assistant. Now testing Mqtt and Sonoff devices (with tasmota firmware).

I tested mqtt works ok with hello world messages, with to putty terminals or putty and home assistant interface.

Now i do this kind settings one my sonoff switch.

When i toggle switch ON my browser. Sonoff switch goes ON just like i want, BUT after couple seconds HA browser shows switch goes back OFF state. Sonoff leave that ON state. If i try manually off sonoff that goes back to ON state after couple seconds. Only way i get that “permanent ON” state off, i need to stop mosquitto service, delete percident file and start mosquitto service again.

I am very thankfull if someone can help me with this problem.

edit: I try this too, but not helped:

  • platform: mqtt
    name: “Sonoff”
    state_topic: “stat/s20-001/POWER”
    command_topic: “cmnd/s20-001/POWER”
    optimistic: false
    payload_on: “ON”
    payload_off: “OFF”
    qos: 1
    retain: true