Mosquitto is the MQTT broker most people run when they have Home Assistant. HASS.Agent is a Windows app that turns your PC into a sensor node for Home Assistant — via MQTT. When the two stop talking to each other, things get annoying fast.
I have HASS.Agent running on my laptop, configured to send a periodic full-screen screenshot to Home Assistant so I can monitor the current state of the machine from the dashboard. It had been working fine for months.
Then a popup started appearing on my screen every few minutes. MQTT connection lost. Reconnecting. Lost again. I had no idea why.
Looking at the Mosquitto log on my Home Assistant box, the pattern was obvious:
2026-06-10 18:14:46: New connection from 192.168.50.54:52532 on port 1883. 2026-06-10 18:14:46: New client connected from 192.168.50.54:52532 as 25dfc49c (p4, c1, k15, u’muki’). 2026-06-10 18:14:52: Client 25dfc49c [192.168.50.54:52532] disconnected: oversize packet. 2026-06-10 18:14:53: New connection from 192.168.50.54:52533 on port 1883. 2026-06-10 18:14:53: New client connected from 192.168.50.54:52533 as 25dfc49c (p4, c1, k15, u’muki’). 2026-06-10 18:14:53: Client 25dfc49c [192.168.50.54:52533] disconnected: oversize packet. 2026-06-10 18:14:57: New connection from 192.168.50.54:52534 on port 1883. 2026-06-10 18:14:57: New client connected from 192.168.50.54:52534 as 25dfc49c (p4, c1, k15, u’muki’). 2026-06-10 18:15:04: Client 25dfc49c [192.168.50.54:52534] disconnected: oversize packet. 2026-06-10 18:15:05: New connection from 192.168.50.54:52536 on port 1883. 2026-06-10 18:15:05: New client connected from 192.168.50.54:52536 as 25dfc49c (p4, c1, k15, u’muki’). 2026-06-10 18:15:05: Client 25dfc49c [192.168.50.54:52536] disconnected: oversize packet.
A recent update to Mosquitto introduced a default max packet size limit, and a 4K screenshot is larger than whatever that default is. Every time HASS.Agent tried to send the screenshot, it hit the limit, got dropped, immediately reconnected, and hit the limit again. Hence the popup, every few minutes.
The fix is a custom Mosquitto configuration file. On my Home Assistant OS install, custom config goes in /root/share/mosquitto/. I created mosquitto.conf there with:
max_packet_size 2000000000
That is 2 GB, which is more than enough headroom for a 4K screenshot. Restart the Mosquitto add-on, and the disconnections stop.
The two threads that pointed me to the fix:
If you’re running HASS.Agent with screenshot sensors and your MQTT connection keeps dropping with oversize packet in the log, this is your fix.




