I’ve just been through a fresh install of Hassio 64bit on a Pi3 B+. I had my YAML files from before and have got HA to a similar state to where it was before. The issue i’m having is with my existing Tasmota devices, the device state is not being updated after HA reboot. This is not the case for my Espurna devices so i’m wondering if it’s a QOS type of issue. Has anyone experienced this problem and how did you overcome it? Never had this issue before, had a play with some settings but hasn’t worked. I can still control the devices. When showing as off i can then turn them ‘on’, which does nothing. This state change is then shown in HA and i’m then able to turn ‘off’ etc as normal.
Reposted this from the configuration sub into this one where i think it sits better.
It sounds like the Espurna devices are publishing to topics with retain=true whereas the Tasmota devices use retain=false.
Compare the retain flags for both types of devices and see if my theory is true/false.
As @123 says, the tasmota are likely
retain: false unless you have changed that. Setting this to true means that when HA comes online and tells your MQTT broker what it is interested in, the broker responds with any relevant retained state messages it has. HA then updates its states from these messages.
If you don’t want to introduce retain gremlins into your system, the alternative is to have an automation in HA, triggered when HA finishes loading, that requests the state of each MQTT device.
Ideally, you want state topics to be retained and not the command topics.
In other words, your Tasmota and Espurna switches should publish their states with retain on. You’ll typically be using Home Assistant to command the switches so ensure you set retain: false for each MQTT Switch entity in HA.
When Home Assistant restarts, it reconnects to the MQTT Broker and re-subscribes to the switch topics. It’ll receive values for all retained topics. If it’s only the state topics, then HA will know which lights are on/off, doors that are open/closed, etc. On the other hand, if it also receives values for command topics, it’ll act on them and open garage doors, unlock locks, turn on sprinkler valves and do other things you probably don’t want to happen after a reboot!