2 SonoffTH with Tasmota - Identical setting, but one not showing Switch state in Home Assistant

I flashed two SONOFF TH 16 with Tasmota 6.4.1 then updated to 6.5.0.
Both have a sensor plug in one with the DS18B20 TEMP sensor (controle_spa)
and one with SI7021 TEMP and HUM sensor (controle_foyer)
Both sensors shows the value inside the HTML page of the device.

The one with the SI7021 shows the switch and TEMP/HUM in Home assistant and work great.
The one with the DS18B20 shows the TEMP in Home Assistant, show the switch always OFF, but if I click ON in Home Assistant the command is sent to the device with become ON but Home Assistant always show it at OFF.

Can somebody Help, thanks

Both device received the same Retain off and the mqtt server erase retain message.

> SwitchRetain Off
> ButtonRetain On
> ButtonRetain Off
> PowerOnState 3
> PowerRetain On
> mosquitto_pub -h [brokerIP] -p 1883 -u [user] -P [password] -t stat/controle_foyer/POWER1 -r -m 
> mosquitto_pub -h [brokerIP] -p 1883 -u [user] -P [password] -t stat/controle_foyer/POWER -r -m 
> mosquitto_pub -h [brokerIP] -p 1883 -u [user] -P [password] -t stat/controle_foyer/LWT -r -m 

Here the yaml config for the switchs

>   - platform: mqtt
>     name: "Controle Spa"
>     state_topic: "stat/controle_Spa/POWER1"
>     command_topic: "cmnd/controle_spa/POWER"
>     availability_topic: "tele/controle_spa/LWT"
>     qos: 1
>     payload_on: "ON"
>     payload_off: "OFF"
>     payload_available: "Online"
>     payload_not_available: "Offline"
>     retain: false
>     unique_id: 84F3EBA88756-SWIT    

>   - platform: mqtt
>     name: "Controle Foyer"
>     state_topic: "stat/controle_foyer/POWER1"
>     command_topic: "cmnd/controle_foyer/POWER"
>     availability_topic: "tele/controle_foyer/LWT"
>     qos: 1
>     payload_on: "ON"
>     payload_off: "OFF"
>     payload_available: "Online"
>     payload_not_available: "Offline"
>     retain: false
>     unique_id: 84F3EBA891C3-SWIT


Found the problem - Newby error first topic control_Spa shouldn’t have a caps on “s”.

1 Like

Thank god someone that posts the solution after finding the error themselves. Kudos.

Anyways, you could use Home Assistant auto discovery with tasmota (SetOption19 on). This way you won’t have to configure the switch yourself and if something changes you won’t need to restart Home Assistant to make it work again.

Thanks jimz011,

I’ve tried and tried to do the auto discovery, but no luck I was never able to make it work (probably another capital S somewhere) loll… For now I did solve the problem by adding them in yaml file… and its working like a charm… I’m trying to build a new host on an old Mac mini with ubuntu instead of Mac, I’ll give it a another try for the discovery.

Hm, I’m guessing autodiscovery doesn’t work? Try this:

On your sonoff, open the configuration and set the module to a basic one (the first module listed). Restart and type “SetOption19 on” in the console without the quotes.

You should be seeing stuff happening in the console with some home assistant topics being thrown out. If it works change the module back to what it was. Autodiscovery should now be working.