HA doesn't update a Light status until a "tele" comes thru every 5 mins

Latest build. OSX. Yosemite. 10.10.3
Latest Tasmota flashed to Sonoff.
Flashed with esptool.py
Did NOT auto-discover sonoff devices - manually editing configuration.yaml

Using HA, I can successfully turn On/Off a Sonoff Basic. (also from web, or command line)
But after I turn On, for example, in about 1 second, the visual switch indicator will revert to off. But the light turned on.
Wait for the “tele” and HA will update to show light On.

Same for off… will turn off right away, but HA doesn’t think its off… until “tele” after 300 second refresh.

Seems to not understand/parse this:
21:15:55 MQT: stat/sonoff-LivingRoomLight/POWER = OFF (retained)

But updates correctly from this:
21:19:53 MQT: tele/sonoff-LivingRoomLight/STATE = {“Time”:“2019-01-29T21:19:53”,“Uptime”:“0T21:35:13”,“Vcc”:3.618,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER”:“OFF”,“Wifi”:{“AP”:1,“SSId”:“who_r_u24”,“BSSId”:“CC:40:D0:65:00:B9”,“Channel”:4,“RSSI”:100}}

Config:
light:

  • platform: mqtt
    name: “Sonoff Living Room Light”
    state_topic: “tele/sonoff-LivingRoomLight/STATE”
    command_topic: “cmnd/sonoff-LivingRoomLight/POWER”
    availability_topic: “tele/sonoff-LivingRoomLight/LWT”
    value_template: “{{ value_json.POWER }}”
    qos: 1
    payload_on: “ON”
    payload_off: “OFF”
    payload_available: “Online”
    payload_not_available: “Offline”
    retain: true

I’m new and this is my first device.
Is the Telemetry supposed to be more frequent than 300 secs?
After HA turns a device on (and I see the switch revert to off), is it in fact polling the device and trying to indicate to me that the device didn’t really turn on?

From the Sonoff console, these are the only 2 message that appear when I flip a switch in HA:
21:15:55 MQT: stat/sonoff-LivingRoomLight/RESULT = {“POWER”:“OFF”}
21:15:55 MQT: stat/sonoff-LivingRoomLight/POWER = OFF (retained)

Shouldn’t one of those be a “cmnd” and not a “status”?

thx
jaymer…

Your state_topic likely should be similar to “stat/sonoff-LivingRoomLight/POWER”
Tasmota has 3 topics, which by default are:

  1. cmnd - any changes, originate from the broker (via HA) to do something.
  2. stat - all state changes on the device sent towards the broker which is received on HA.
  3. tele - telemetry data, typically from onboard sensors, sent from device to broker ever telemetry_interval.

You can use an MQTT client to listen to all messages coming into “stat/#”

There is an automation in the Tasmota Wiki for Home Assistant to fix this.

I can’t post that here right now but if you can’t find it let me know and I’ll post it when my computer is on.

You’re using this right?

# Example automations.yaml entry
- alias: "Power state on HA start-up"
  trigger:
    platform: homeassistant
    event: start
  action:
    - service: mqtt.publish
      data:
        topic: "sonoffs/cmnd/state"
        payload: "" 

Well that one will only work if you are using MQTT discovery.

If you are not using discovery, change the topic to cmnd/sonoffs/state

Yes, bad line in config.
Should have been:
state_topic: “stat/sonoff-LivingRoomLight/POWER”

That, coupled with the automation to correctly set the switch value after HA restart worked.
Thanks to @DavidFW1960 for this:

Example automations.yaml entry

  • alias: “Power state on HA start-up”
    hide_entity: true
    trigger:
    platform: homeassistant
    event: start
    action:
    • service: mqtt.publish
      data:
      topic: “stat/sonoff-LivingRoomLight/RESULT”
      payload: “”

This was a good video on troubleshooting and helped me clean things up.