Sonoff Tasmota MQTT Issue

Hey there,

I have a few Sonoff Devices flashed with Tasmota 5.14 and android-core 2.3.0 and they worked fine. I have added them to HA as switches/lights via MQTT (using mosquitto). Today I realized that one of my Sonoffs would turn itself off right after I had turned it on via HA. I think I had restarted HA prior to the issue. So I did some research and thought it could be caused by a bugged retained message. So I cleared the retained messages, which fixed the problem but weirdly caused a new issue: HA does not read any states of my MQTT switches/lights anymore. They are always shown as off, switching them does send the payload “on”, but the switch will jump back to off anyway.
I can send mqtt messages from HA and they are received normally. HA is also subscribed to other topics (zigbee2mqtt) which states are received correctly by HA.

Here is my config:

mqtt:
  broker: core-mosquitto
  username: Redacted
  password: !secret mqtt_pass
  discovery: true
  discovery_prefix: homeassistant
light:
  - platform: mqtt
    name: Schlafzimmer
    state_topic: "stat/LichtSchlafzimmer/POWER1"
    command_topic: "cmnd/LichtSchlafzimmer/POWER1"
    availability_topic: "tele/LichtSchlafzimmer/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false
switch:
  - platform: mqtt
    name: "Bildschirm"
    state_topic: "stat/Bildschirm/POWER1"
    command_topic: "cmnd/Bildschirm/POWER1"
    availability_topic: "tele/Bildschirm/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false

I also have the PowerRetain option enabled on the devices. As I said, I did not really change anything (except for restarting Hass.io and adding another Sonoff)

Any help/Ideas?

This normally indicates that the state_topic: has not been received or understood. Try using mosquitto_sub to subscribe to all topics, and see what your sonoff is actually sending out. I don’t have any, but from other posts I seem to remember that they send the topic in lower case.

For whatever reason “stat/Bildschirm/POWER1” does not send any message at all, but “stat/Bildschirm/POWER” does. But I thought POWER1 was the intended way to use it (they changed it recently), or did they only change this for Sonoffs with multiple channels? But changing it to “POWER” fixed it.

I made a different observation though, which also worries me a little:

tele/Bildschirm/INFO1 {"Module":"S20 Socket","Version":"5.14.0","FallbackTopic":"Socket_Schlafzimmer","GroupTopic":"sonoffs"}
tele/Bildschirm/INFO2 {"WebServerMode":"Admin","Hostname":"Bildschirm-3033","IPAddress":"192.168.0.30"}
tele/Bildschirm/INFO3 {"RestartReason":"Fatal exception:28 flag:2 (EXCEPTION) epc1:0x4000e1e0 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000"}

It seems to crash fairly often right now…

1 Like

The crashing problem seems more of a question for the tasmota discussion forum.

1 Like