Closed bazmk2 closed 2 years ago
mqtt documentation mqtt source (message by IssueLinks)
Hey there @emontnemery, mind taking a look at this issue as it has been labeled with an integration (mqtt
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
This week I have upgraded to the latest version of HA core and also upgraded the Mosquitto to the latest. I am not sure where the issue is with the MQTT or the HA core instance - I think it is mosquitto.
Please explain more about your Mosquitto setup, are you using the official Mosquitto addon or something else?
Also, the mosquitto log shows your Tasmota devices reconnecting to the MQTT broker, but I don't see anything about Home Assistant reconnecting, does that appear to be stable?
If you execute command status11
on the Tasmota devices, what does it say?
@maframan, this could maybe be related to your problem
Using the HA official Mosquitto addon 6.0.1
I can't see any HA disconnects to the Mosquitto. I think I did on the initial install but will have to spin the VM up to look. I presume that they would appear on the docker network IP.
Tasmota Device (UK Sonoff T1 3 gang) with 10.0.0
20:33:28.053 CMD: status11
20:33:28.059 MQT: stat/tasmota_98B603/STATUS = {"Status":{"Module":30,"DeviceName":"Tasmota","FriendlyName":["Tasmota","Tasmota2","Tasmota3"],"Topic":"tasmota_98B603","ButtonTopic":"0","Power":7,"PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0,"InfoRetain":0,"StateRetain":0}}
20:34:05.704 MQT: Attempting connection...
20:34:06.457 MQT: Connected
20:34:06.462 MQT: tele/tasmota_98B603/LWT = Online (retained)
20:34:06.465 MQT: cmnd/tasmota_98B603/POWER =
20:34:12.846 MQT: stat/tasmota_98B603/STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota/release/tasmota.bin.gz","RestartReason":"Exception","Uptime":"1T02:30:35","StartupUTC":"2021-12-21T17:03:37","Sleep":50,"CfgHolder":4617,"BootCount":1013,"BCResetTime":"2020-08-28T12:11:45","SaveCount":6178,"SaveAddress":"F5000"}}
20:34:12.898 MQT: stat/tasmota_98B603/STATUS11 = {"StatusSTS":{"Time":"2021-12-22T20:34:12","Uptime":"1T02:30:35","UptimeSec":95435,"Heap":24,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":1906,"POWER1":"ON","POWER2":"ON","POWER3":"ON","Wifi":{"AP":1,"SSId":"daveandvickyiot","BSSId":"86:2A:A8:C4:79:CB","Channel":11,"Mode":"11n","RSSI":100,"Signal":-39,"LinkCount":1,"Downtime":"0T00:00:09"}}}
20:34:12.948 MQT: tele/tasmota_98B603/STATE = {"Time":"2021-12-22T20:34:12","Uptime":"1T02:30:35","UptimeSec":95435,"Heap":24,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":1906,"POWER1":"ON","POWER2":"ON","POWER3":"ON","Wifi":{"AP":1,"SSId":"daveandvickyiot","BSSId":"86:2A:A8:C4:79:CB","Channel":11,"Mode":"11n","RSSI":100,"Signal":-39,"LinkCount":1,"Downtime":"0T00:00:09"}}
20:34:12.951 MQT: stat/tasmota_98B603/RESULT = {"Time":"2021-12-22T20:34:12","Uptime":"1T02:30:35","UptimeSec":95435,"Heap":24,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":1906,"POWER1":"ON","POWER2":"ON","POWER3":"ON","Wifi":{"AP":1,"SSId":"daveandvickyiot","BSSId":"86:2A:A8:C4:79:CB","Channel":11,"Mode":"11n","RSSI":100,"Signal":-39,"LinkCount":1,"Downtime":"0T00:00:09"}}
20:34:38.232 MQT: tele/tasmota_98B603/STATE = {"Time":"2021-12-22T20:34:38","Uptime":"1T02:31:01","UptimeSec":95461,"Heap":22,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1906,"POWER1":"ON","POWER2":"ON","POWER3":"ON","Wifi":{"AP":1,"SSId":"daveandvickyiot","BSSId":"86:2A:A8:C4:79:CB","Channel":11,"Mode":"11n","RSSI":100,"Signal":-39,"LinkCount":1,"Downtime":"0T00:00:09"}}
20:34:50.982 MQT: Attempting connection...
20:34:51.050 MQT: Connected
20:34:51.054 MQT: tele/tasmota_98B603/LWT = Online (retained)
20:34:51.058 MQT: cmnd/tasmota_98B603/POWER =
20:34:52.164 MQT: stat/tasmota_98B603/STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"http://ota.tasmota.com/tasmota/release/tasmota.bin.gz","RestartReason":"Exception","Uptime":"1T02:31:15","StartupUTC":"2021-12-21T17:03:37","Sleep":50,"CfgHolder":4617,"BootCount":1013,"BCResetTime":"2020-08-28T12:11:45","SaveCount":6178,"SaveAddress":"F5000"}}
20:34:52.214 MQT: stat/tasmota_98B603/STATUS11 = {"StatusSTS":{"Time":"2021-12-22T20:34:52","Uptime":"1T02:31:15","UptimeSec":95475,"Heap":22,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":44,"MqttCount":1907,"POWER1":"ON","POWER2":"ON","POWER3":"ON","Wifi":{"AP":1,"SSId":"daveandvickyiot","BSSId":"86:2A:A8:C4:79:CB","Channel":11,"Mode":"11n","RSSI":100,"Signal":-39,"LinkCount":1,"Downtime":"0T00:00:09"}}}
20:34:52.263 MQT: tele/tasmota_98B603/STATE = {"Time":"2021-12-22T20:34:52","Uptime":"1T02:31:15","UptimeSec":95475,"Heap":21,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":43,"MqttCount":1907,"POWER1":"ON","POWER2":"ON","POWER3":"ON","Wifi":{"AP":1,"SSId":"daveandvickyiot","BSSId":"86:2A:A8:C4:79:CB","Channel":11,"Mode":"11n","RSSI":100,"Signal":-39,"LinkCount":1,"Downtime":"0T00:00:09"}}
20:34:52.265 MQT: stat/tasmota_98B603/RESULT = {"Time":"2021-12-22T20:34:52","Uptime":"1T02:31:15","UptimeSec":95475,"Heap":21,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":43,"MqttCount":1907,"POWER1":"ON","POWER2":"ON","POWER3":"ON","Wifi":{"AP":1,"SSId":"daveandvickyiot","BSSId":"86:2A:A8:C4:79:CB","Channel":11,"Mode":"11n","RSSI":100,"Signal":-39,"LinkCount":1,"Downtime":"0T00:00:09"}}
Also I am not sure if this is related but I have this in the HA log today too
Logger: homeassistant.components.websocket_api.http.connection Source: components/websocket_api/http.py:126 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 00:19:11 (22 occurrences) Last logged: 19:23:42
[2703208968] Client unable to keep up with pending messages. Stayed over 512 for 5 seconds [2793777520] Client unable to keep up with pending messages. Stayed over 512 for 5 seconds [2783955096] Client unable to keep up with pending messages. Stayed over 512 for 5 seconds [2792435848] Client unable to keep up with pending messages. Stayed over 512 for 5 seconds [2747011784] Client unable to keep up with pending messages. Stayed over 512 for 5 seconds
i suspect that the problem is caused by mosquitto watch dog feature because before activation I did not have this drop connection situation . Now i've disabled watchdog and tomorrow I'll let you know
@bazmk2 OK, so something is seriously wrong with either your Tasmota device or the Mosquitto broker, "MqttCount":1907
means Tasmota has reconnected 1907 times to the broker during just 1 day.
i suspect that the problem is caused by mosquitto watch dog feature because before activation I did not have this drop connection situation . Now i've disabled watchdog and tomorrow I'll let you know
Today, the situation after Watchdog disabled, is very stable. I think that the disconnection/drop problem has been resolved.
So I have deleted my previous comments and logs as I beleive they are irrelevant.
I believe I have solved the issue and it is to do with the tasmota software on the devices. I have found that the later versions of the software (not sure exactly where) change the way that they act in terms of wifi and reboot/reconnect. It turns out that I had set a NTP server in my DHCP some time previous that I had forgotten about. However, on "update day" - i chose to update OTA the HA, mosquitto and tasmota software around the same time I beleive that the Tasmota update introduced the issue with the NTP server and caused the reconnects.
Yesterday I looked at the device list in tasmota-admin and all of the devices except one still on 9.x had uptimes of a minutes. The one on 9.x was at 17 days.
Now of course I was still fiddling - I was trying to fix this so I have introduced some other confounders - the MQTT brocker I use is not a seperate debian machine with HiveMQ setup but it wasnt until I removed the NTP setting that I got uptimes of over an hour for the tasmota devices.
Hopefully this may be of assistance to another tinkerer - my one message is change 1 thing and WAIT!
The problem
The short story: Device connected via MQTT frequently drop out and reconnect. This means that in the UI they grey out frequently or do not respond appropriately.
The Long Story: This issue began this week with frequent drop outs of devices that I first noticed on Zigbee Devices. I had a fairly complex setup with 2 instances of HA setup. One was on a VM via a supervised install, the other on an orangePiPC on armbian install (supervised). The rationale for this was that the VM (on ESXi) was the powerhouse and the OPi was the zwave and zigbee gateway. The 2 instancew were connected via the zwavejs integration pointed at the OPi IP and via MQTT from zigbee2mqtt. The MQTT broker was hosted on the VM. Additional info - the VM is hosted on ESXi 6.7 running on a debian 10 OS. The decision to run a seperate instance on the OPi was due to the ESXi host machine being a HP DL380 rack server a bit noisy and lives in the garage but the zwave and zigbee performance was poor due to radio interferance and range as it wasnt in the house - the OPi is
This all worked perfectally. This week I have upgraded to the latest version of HA core and also upgraded the Mosquitto to the latest. I am not sure where the issue is with the MQTT or the HA core instance - I think it is mosquitto.
I get regular client disconnects in the MQTT log, my recorder shows frequent gaps i.e. a light is not off from 10:00 to 120:00 but off from 10:00to10:05, 10:07 to 10:23, 10:24 to ......... You get the drift
In my frustration I have
What version of Home Assistant Core has the issue?
core-2021.12.4
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
MQTT
Link to integration documentation on our website
https://www.home-assistant.io/integrations/mqtt/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response