Tasmota Question

I have the new tasmota integration running as of yesterday but the issue was that after HA restart all entities were shown as unavailable. To fix this I added the following automation in HA, maybe it helps someone out.

alias: HA start
description: ''
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - service: mqtt.publish
    data:
      topic: cmnd/tasmotas/SetOption19
      payload: 0
mode: single
1 Like

I think you should use this, I forgot who I got this from but it gets the state. Adjust the topic as needed
Option 19 is for auto discovery

  alias: Power State Sonoff on HA Start-Up
  description: ''
  trigger:
  - event: start
    platform: homeassistant
  condition: []
  action:
  - data:
      payload: ''
      topic: sonoffs/cmnd/state
    service: mqtt.publish

Thanks @odt, I think I was going crazy because none of the recommended tasmota automations for Home Assistant were working:

https://tasmota.github.io/docs/Home-Assistant/#useful-automations

The only thing that did the trick and allowed HA to discover all my tasmota devices after a restart was issuing a SetOption19 0 to all devices.

I do not know why :man_shrugging:

This is my configuration:

- id: '1608189823500'
  alias: Tasmota Discovery at Startup
  description: Discover all tasmota devices when Home Assistant restarts
  trigger:
  - platform: homeassistant
    event: start
  condition: []
  action:
  - service: mqtt.publish
    data:
      topic: tasmotas/cmnd/status
      payload: ''
  - service: mqtt.publish
    data:
      topic: cmnd/tasmotas/status
      payload: ''
  - service: mqtt.publish
    data:
      topic: cmnd/tasmotas/state
      payload: ''
  - service: mqtt.publish
    data:
      topic: tasmotas/cmnd/state
      payload: ''
  - service: mqtt.publish
    data:
      topic: cmnd/tasmotas/SetOption19
      payload: 0
  mode: single

Note that the first four MQTT topics should make the devices report their state (which it does) but they do not get discovered by HA after a restart. It is only the last one that makes it work.

Same as you, I am using the Tasmota (beta) integration in Home Assistant.

Cheers!

Correct, reporting their state has nothing to do with identifying themselves as discoverable devices to Home Assistant. To do that, they must comply with the requirements of Home Assistant’s MQTT Discovery and that’s the purpose of SetOption19.

Hi @Taras,

I agree with you, but the confusion here lies in how the Tasmota (beta) vs. MQTT integrations work.

If you are using just the MQTT integration in Home Assistant, by all means you need to use SetOption19 1 for auto discovery. This works great, no problem here.

The problem comes when you rely on the Tasmota (beta) and not on the MQTT integration to re-discover your devices after a restart of Home Assistant. This means that your devices won’t follow the topic naming convention for HA to discover them, it is the Tasmota (beta) integration that handles that instead.

And so, the problem is that, according to the suggested useful automations in Tasmota’s documentaiton, those topics should do the job… but they don’t (at least not for me). It is only when you issue a SetOption19 0 (note, we are effectively disabling MQTT HA auto discovery feature here), when the Tasmota (beta) integration picks up all my Tasmota devices after a restart of HA.

Probably there is a bug somewhere in the Tasmota (beta) integration, it says beta after all, right? But the truth is that this is the only way I made it work :slight_smile:

Cheers!

The confusion is that this topic was started in April 2019, well before the Tasmota integration existed, and is about the MQTT Integration. User odt has re-opened a 2-year old topic, about the MQTT integration, to discuss a different integration (Tasmota integration).

Screenshot from 2020-12-19 09-29-28

I agree the new Tasmota integration uses a different technique for discovering devices and SetOption19 1 is exclusively for use with Home Assistant’s native style of MQTT Discovery (not Tasmota’s new style).

I’ve asked the moderators to split this thread at odt’s first post because it is not discussing the same subject as the original thread.