Home Assistant able to publish MQTT commands but not subscribe to state

I am running Home Assistant 0.82.0 in a docker container. I have a separate mosquitto server running successfully. My MQTT configuration is:

mqtt:
  broker: 192.168.1.100
  port: 1883
  client_id: hass
  username: mosquitto
  password: "PASSWORD"

I have some sonoff switches running the tasmota custom firmware. I have set up the switches as close to default as possible. My switch configuration in HA is:

- platform: mqtt
  name: "Sonoff Switch 1"
  state_topiic: "stat/SONOFF_01/POWER"
  command_topic: "cmnd/SONOFF_01/POWER"
  availability_topic: "tele/SONOFF_01/LWT"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  state_on: "ON"
  state_off: "OFF"
  payload_available: 'Online'
  payload_not_available: 'Offline'
  retain: false

I can use HA to turn the switch on and off, and this works correctly. It also correctly updates the state in the HA GUI. However, when I turn the switch on and off using the hardware button, the state does not update in HA. I can subscribe the to the MQTT topic via the command line, and I see the same messages both ways. So why doesn’t HA see the status?

I haven’t upgraded to 0.82 yet, but this seems very strange. For the sake of another set of eyeballs, can you paste the output of your command line test.

You have a typo here.

2 Likes

Well F. I guess that’s why you post the real code rather than saying “I configured it correctly.”

We use YAML for some codes I develop at work, too, and this is my biggest beef with it. Easy to put in typos and get surprised. Thanks, @VDRainer.