Sonoff Docker Home Assistant and MQTT: Sonoff not working in HA

Can you please help me control my sonoff basic?

I have installed external MQTT on Rasbian.
The configuration.yaml is bellow:

# Mosquitto
mqtt:
  broker: 192.168.2.100
  port: 1883
  client_id: home-assistant-1
  keepalive: 60
  username: mqtt_user
  password: ********

#Switches
switch:
  - platform: mqtt
    name: "Sonoff_81"
    icon: mdi:lamp
    state_topic: "stat/sonoff_81/POWER"
    command_topic: "cmnd/sonoff_81/POWER"
    payload_on: "ON"
    payload_off: "OFF"
    state_on: "ON"
    state_off: "OFF"
    qos: 1
    retain: false

The sonoff’s MQTT parameters are as follows:

Sonoff stays ON event if I toggle it from the web console. It switches off and instantly off!
Inside HA the switch shows always off even if I click it on it goes off instantly.
Tasmota firmware is 6.5.0
What am I doing wrong?

Why you don’t use auto-discovery ? Simply enter setoption19 1 in the tasmota console.

I do not know what it does. If I use it do I have to change anything in the configuration?

You will have to remove the switch from your configuration.yaml. Everything to configure the switch will be sent from tasmota to HA.

(You need to keep the configuration of your mqtt broker!)

OK, I did enabled auto-discovery option. So where do I find the switch then?

Configuration/Intergrations
Developer tool/stateui
Unsed entites in lovelace

Unfortunately I cannot see the switch.

Open the switch in the browser
Console
Type
SetOption19 1

I already did that George… Twice.

What module did you flash ? tasmota-basic.bin does not support auto-discovery, you need to upgrade to tasmota.bin first.

I used sonoff.bin from here (Sonoff-Tasmota v6.6.0)

Okey dokey
Did you see
homeassistant messages in the console after you did that.

I’m not sure, I will have to do it again and check.

Can I ask what is it that your connecting

I am trying to connect a couple of SonOff’s Basic.

Hi,

I am seeing homeassistant messages. See below:

19:55:32 MQT: sonoff_81/tele/LWT = Online (retained)
19:55:32 MQT: sonoff_81/cmnd/POWER = 
19:55:33 CMD: SetOption19 1
19:55:33 MQT: sonoff_81/stat/RESULT = {"SetOption19":"ON"}
19:55:33 RSL: homeassistant/light/DEF0F9_LI_1/config = 
19:55:33 RSL: homeassistant/switch/DEF0F9_RL_1/config = {"name":"Sonoff_81","cmd_t":"~cmnd/POWER","stat_t":"~tele/STATE","val_tpl":"{{value_json.POWER}}","pl_off":"OFF","pl_on":"ON","avty_t":"~tele/LWT","pl_avail":"Online","pl_not_avail":"Offline","uniq_id":"DEF0F9_RL_1","device":{"identifiers":["DEF0F9"]},"~":"sonoff_81/"}
19:55:33 RSL: homeassistant/light/DEF0F9_LI_2/config = 
19:55:33 RSL: homeassistant/switch/DEF0F9_RL_2/config = 
19:55:33 RSL: homeassistant/light/DEF0F9_LI_3/config = 
19:55:33 RSL: homeassistant/switch/DEF0F9_RL_3/config = 
19:55:33 RSL: homeassistant/light/DEF0F9_LI_4/config = 
19:55:33 RSL: homeassistant/switch/DEF0F9_RL_4/config = 
19:55:33 RSL: homeassistant/light/DEF0F9_LI_5/config = 
19:55:33 RSL: homeassistant/switch/DEF0F9_RL_5/config = 
19:55:33 RSL: homeassistant/light/DEF0F9_LI_6/config = 
19:55:33 RSL: homeassistant/switch/DEF0F9_RL_6/config = 
19:55:33 RSL: homeassistant/light/DEF0F9_LI_7/config = 
19:55:33 RSL: homeassistant/switch/DEF0F9_RL_7/config = 
19:55:33 RSL: homeassistant/light/DEF0F9_LI_8/config = 
19:55:33 RSL: homeassistant/switch/DEF0F9_RL_8/config = 
19:55:33 RSL: homeassistant/sensor/DEF0F9_status/config = {"name":"Sonoff_81 status","stat_t":"~HASS_STATE","avty_t":"~LWT","pl_avail":"Online","pl_not_avail":"Offline","json_attributes_topic":"~HASS_STATE","unit_of_meas":" ","val_tpl":"{{value_json['RSSI']}}","uniq_id":"DEF0F9_status","device":{"identifiers":["DEF0F9"],"name":"Sonoff_81","model":"Sonoff Basic","sw_version":"6.6.0(release-sonoff)","manufacturer":"Tasmota"},"~":"sonoff_81/tele/"}
19:55:34 MQT: Attempting connection...
19:55:34 MQT: Connected
19:55:34 MQT: sonoff_81/tele/LWT = Online (retained)
19:55:34 MQT: sonoff_81/cmnd/POWER = 
19:55:36 MQT: Attempting connection...
19:55:36 MQT: Connected
19:55:36 MQT: sonoff_81/tele/LWT = Online (retained)
19:55:36 MQT: sonoff_81/cmnd/POWER = 
19:55:37 MQT: Attempting connection...
19:55:37 MQT: Connected

Does this bin supports auto-discovery?
I used sonoff.bin from here (Sonoff-Tasmota v6.6.0)