TASMOTA switch not shown just if i restart tasmota (in older release of homasistant it is worked)

Hello

I upgraded my homasistant to a newer version. NOW:
Tasmota switches not shown until i restart tasmota or click on it even i added availability topic.
2022_09_15_10_56_01_Gy_AranyJ_19_a_Home_Assistant

If i restart Tasmota:

2022_09_15_10_57_39_Gy_AranyJ_19_a_Home_Assistant

corresponding yaml:

     - name: "GA_em_GySz_lampa01"
       unique_id: "GA_em_GySz_lampa01"
       command_topic: "cmnd/GA_em_GySz_lampa01/POWER"
       state_topic: "stat/GA_em_GySz_lampa01/POWER"
       availability_topic: "tele/GA_em_GySz_lampa01/LWT"
       qos: 1
       payload_on: "ON"
       payload_off: "OFF"
       payload_available: "Online"
       payload_not_available: "Offline"
       retain: true

I wonder what should i change so HA behave like before?

Thanks

Do you still have the old manual yaml based config as well as the auto-discovered config in the Tasmota integration? Do you now have duplicate entities?

yes i moved all my old config to a new system.
Checked developertools/state not see any duplicate

I see the same with custom Python code using HASS Discovery - the lightening bolts disappear when the device sends out a TELE state and a switch appears as the state is known.

This suggests you might want to double-check SetOption19 0 on the Tasmota console on all devices.

Thank you. it is set to 0.

16:48:05 MQT: stat/GA_em_GySz_lampa01/RESULT = {"SetOption19":"OFF"}

Sudden thought - have you checked if the MQTT broker has old retained messages with HASS discovery for the device?
I had to manually delete them when switching from HASS Discovery to Tasmota Discovery as one was masking the other. ISTR this took me a bit of head-scratching and lots of reboots of broker and Tasmota devices.

You’d have thought a reboot of HASS and the broker would clear retailed messages, but that’s my last thought before suspecting a bug somewhere.

One last test might be to flash a new device with the latest Tasmota and see what happens in HASS and MQTT explorer. Once did that to test my understanding and sanity! :woman_mage:t2: :exploding_head: :face_with_symbols_over_mouth:

Hello,
Thank you

I am using homeassistant not hass during system restore i needed to realize that hass not support any more my setup.

Recently i needed to restart all my container lots of time so it should not be staked in message i think.


I see the LWT message in mqtt browser after connection immediately after connection. so i would say that mosquito is working well.

  • Old Home Assistant Discovery published device details to the homeassistant/# topic.
  • New Tasmota Discovery publishes device details to the tasmota/discovery/# toplc.

If a device has both due to retained messages being saved across reboots by the MQTT broker, you have a problem. These are not Last Will and Testament (LWT = online) retained topics.

Basically, delete ALL topics under homeassistant and restart to be sure (only specific devices like Octoprint use HASS Discovery).

  • homeassistant/sensor
  • homeassistant/switch
  • homeassistant/binary_sensor
  • homeassistant/button

Does that support manually added/supplemental switches/sensors etc?
I haven’t tried yet…

The docs still seem to point to homeassistant/topic for supplementary stuff.

hello James and HasQT,

Thank you for your help.

This is all manually added components (sensors/switches) all moved from my old system config files.

In mqtt explorer i don’t see any homasistant topic

Also i checked my test system which is still running the old HAS software i didnt see homeasistant topic;
image

Just to be sure checked the DB i didnt see ther neither homeassistant topic

root@GA-HomeA-01:/data/mosquitto/data# cat mosquitto.db | grep -i homeassistant
root@GA-HomeA-01:/data/mosquitto/data#

Just checking…

Your first post
Those images(with the lightning bolt) are from lovelace dashboard entities card or the mqtt integration or tasmota integration?
These are manual switches not discovered switches?

Nevermind you answered that in the last post.

So its the lovelace card having issues? It reports ok in the developer states?

The hierarchy of topics under tasmota/discovery/# are ONLY to tell HASS about a Tasmota device for automatic discovery using the HASS Tasmota integration . These point elsewhere for the actual status and control topics for Tasmota devices (e.g. "ft": "%prefix%/%topic%/").

You can still manually define a Tasmota device as only the STATIC discovery information has changed - not the DYMANIC status and control topics. Tasmota changed to free-up memory and flash space as the original discovery method was cumbersome - that’s what the new Tasmota integration does.

I have written my own MQTT devices in Python which auto-discover using the older HASS Discovery - it still works fine - just replaced in current Tasmota firmware.

More MQTT help if you need it can be found here:

Kinda taking over the topic, I didn’t actually mean to do that.
Supplemental sensors is what I was asking about. You still have to put them in through HA discovery and the MQTT integration from what I understand. Unless you can create a dummy in tasmota.

I haven’t seen a way to add sensors with MQTT via tasmota/macaddress/config is what I meant. (ithe old way does make them visible in Tasmota integration, but doubles up in MQTT integration too)
Supplemental entries

ebalcsk is using manual entries anyway.

hello,

Honestly i am not sure if lovelace card issues or tasmota issue. this is what i see:

The switch is displaying the following icon:
image

The display became normal if i restart or the sensor or i click to the switch.

image

we see that in mqtt explorer LWT is set to online and retained.

this is the config for the switch:

     - name: "GA_em_GySz_lampa01"
       unique_id: "GA_em_GySz_lampa01"
       command_topic: "cmnd/GA_em_GySz_lampa01/POWER"
       state_topic: "stat/GA_em_GySz_lampa01/POWER"
       availability_topic: "tele/GA_em_GySz_lampa01/LWT"
       qos: 1
       payload_on: "ON"
       payload_off: "OFF"
       payload_available: "Online"
       payload_not_available: "Offline"
       retain: true

i guess the

  1. availability_topic: “tele/GA_em_GySz_lampa01/LWT” do nothing for lovelace so dose not meter if i set it up or not.
  2. sensor displayed because tasmota send periodically SENSOR update
  3. switch status not shown because TASMOTA only send switch status if switch status changed

So from here i think or tasmota send switch status regularly or should homasistant pull the status if not sure what is the status

i would prefer if homeassistant would pull the status.

Could you post the Yaml for the card please.

This is enough?

type: entities
entities:
  - entity: sensor.ga_em_gysz_humidity
  - entity: sensor.ga_em_gysz_temperature
  - entity: switch.ga_em_gysz_lampa01

1 Like

So you don’t actually need a state_topic for a switch. Command and availability are enough.

You can

  1. remove the state_topic

  2. value_template string (optional)

    Defines a template to extract device’s state from the state_topic. To determine the switches’s state result of this template will be compared to state_on and state_off.

  3. optimistic boolean (optional)

    Flag that defines if switch works in optimistic mode.
    Default: true if no state_topic defined, else false.

  4. You can also fake the state topic with another entity or sensor. eg if you wanted the state of a card to show as the status of a motion sensor or something.

mqtt switch docs

Edit you also don’t NEED to retain the power on/off unless you really decide you need it retained. To avoid ghost switching on restarts etc