I’m setting up a H801 flashed with Tasmota firmware using Mosquitto MQTT broker on the Raspberry Pi 3 B+ (with hassio 64 bit running - same issue with 32 bit though)
Everything working completely fine other than the states synchronising after Home Assistant reboot.
Example:
RGB Light turned OFF on HA (works fine), and tasmota interface updates perfectly
Turn off Raspberry Pi (light stays off and only thing in the tasmota H801 console is that the mqtt service is has been disconnected as per below):
18:27:02 MQT: Attempting connection…
18:27:07 MQT: Connect failed to 192.168.0.46:1883, rc -2. Retry in 10 sec
Turn light ON using Tasmota interface (I get the following from the console):
I presume that of course because the power off cmnd is being fired without an MQTT broker to retain the message, then this is obviously not being stored.
However I presumed that HA would check the LWT topic on startup and utilise that to sync state as per the device?
Could this be something to do with Mosquitto starting up AFTER Home Assistant on the Pi?
This is odd, because nothing in your configuration is sending that message with an empty payload, and with the retain flag set the broker should get updated whenever HA sends that message.
If you just subscribe to that topic using another client, what gets printed out?
Apologies for the late response - have been away. Appreciate you coming back to me though.
If I subscribe to that topic on any client nothing at all prints out. I also tried subscribing to all topics “#” and upon MQTT reconnection, I get a stat POWER On and a tele LWT Online - nothing on cmnd topic at all, and nothing with an empty payload.
It’s bamboozled me for god knows how long, any help appreciated.
I had a quick look at the tasmota commands page, and its says that the command message without a payload is a query, to send the current status.
If you can’t see that from the broker, I suspect it is being generated internally by the tasmota code, in order to generate the status message when it reconnects. If this was done, it would solve your status synchronization problem.
The question then becomes why the tasmota code isn’t generating a status at that point. Can you try and send it a command with a null payload (or a question mark), to see if it then sends a status message?
I don’t have a tasmota, so I don’t know if they can be configured in this respect, but I would expect them to send out something at startup to indicate the current state.
If not, you could configure an automation in HA to send the cmd/sonoff/POWER message when it gets the online message, to make the sonoff send its state back.
Thanks mate - in lieu of a solution, I have done this and works perfectly. Now to try and get the H801 colours to work with the embedded Homekit integration!