Guys,
I have flashed Sonoff bridge with Tasmota and have a couple of door sensors ( Open & Close state ) working fine in HA.
However, if I reboot HA etc, HA shows all my sensors in a closed state. Please could you help me show the correct state? I followed one youtube videos for the Sonoff basic and that works but unable to get the Bridge using the same console commands.
Thanks
There’s an automation in the Tasmota Wiki.
Thanks , I looking and can not see the automation, any chance you can give the link , if you don’t mind.
Thanks
https://tasmota.github.io/docs/#/integrations/Home-Assistant?id=useful-automations
Scroll down to “Useful Automations” if that link does not take to directly there. Firefox seems to have a problem with the section link.
Hi Tom,
Do I need to change any of the lines for it work or can add to configuration.yaml file like this.
Below copied from the wiki page ( Useful Automation ) :
automation:
- alias: "Sync Tasmota states on start-up - manual configuration"
initial_state: true
trigger:
platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: "cmnd/tasmotas/state"
payload: ""
Should be good as is.
You star, thanks for help.
If Tasmotas doesn’t work try sonoffs- the group topic name was changed recently so it depends on when you flashed Tasmota which it will be using.
Hi Dave,
Is it sonoffs- ( with the dash ) or just sonoffs ?
I add the useful automation ( manual ) to configuration file but still not working. Doors show closed after a restart of HA
Ok , just used both options with " Sonoffs " in the topic line and the doors still show closed after a restart.
Is there any commands I need to add to the tasmota software
You need to set the retain flag when republishing. See
- Your Tasmota-based devices publish their states to the MQTT Broker.
- The MQTT Broker passes on this information to any subscribers (like Home Assistant) that are currently connected to the MQTT Broker.
- This information is available only at the moment it is published.
- If a subscriber connects after the information was published, they will not receive it. That’s because, by default, the MQTT Broker does not store a topic’s message, it only forwards it to current subscribers.
- There is way to instruct the MQTT broker to store (retain) the published message. The publisher (i.e. your Tasmota device) should publish its state as a retained message.
- When a subscriber connects to the MQTT Broker it will receive messages retained by the broker. That means when Home Assistant connects, it will receive the last-known state of Tasmota device.
Here’s an analogy:
- You are in a meeting whose proceedings are not recorded, (i.e. no meeting notes).
- The people in the meeting know what’s discussed and what decisions are made
- The people who arrive late have has no way of learning what was discussed.
Compare that to:
- You are in a meeting whose proceedings are recorded, (i.e. meeting notes).
- The people in the meeting know what’s discussed and what decisions are made
- The people who arrive late receive and read the meeting notes and learn what was discussed.
Retained messages are like the meeting notes in this analogy. Subscribers receive retained messages upon connection to the broker.
No dash. If you are using MQTT discovery the topic order is reversed so you need to change the automation to tasmotas/cmnd/state
Also execute these commands in the Tasmota console:
SwitchRetain 0
ButtonRetain 0
PowerOnState 3
PowerRetain 1
Guys
Thanks for the help so far,
I am using Mosquitto broker and my Sonoff bridge is using the latest Tasmota software.
Thanks
Hey guys, thanks for the suggestions on here. I’m having the same issue and followed the instructions from @DavidFW1960 (both the console commands and the two formats in the automation) but my RF door sensors still reset their state to closed when I reboot HA.
I notice the SwitchRetain and ButtonRetain are set to off, should these be set to on instead? Is there anything else I should try?
Do they eventually say after 30 seconds have the right state? The MQTT status should set them right again and you can accelerate that by manually issuing it in an automation instead of waiting for the Tele period to expire.
Thanks David. No, I left it for about 5 minutes and the status remained as closed.