Bug: MQTT disconnects before sleep, grace period unreliable
The program works perfectly, but whenever I resume my computer from sleep, Hass agent reports 'MQTT failed to connect' which is kind of annoying to dismiss the notification event though it reconnects just fine (after resuming).
To Reproduce Steps to reproduce the behavior:
- Let your windows session go to sleep
- Resume
- Message should pop up
Expected behavior Hass agent should detect when the computer goes to sleep so as to not notify that it can't connect to MQTT.
- Windows 11
- HASS.Agent version: 2022.12.0-beta4
Have you tried setting this to a higher value:

So after testing it yesterday, I set the option you highlited to ~16-17 minutes and the sleep time of my pc to 15 minutes. What I found today is that the message occurs anyway and I had the feeling that it was before going to sleep, but it happens the instant that the pc resumes.
Any ideas?
Interesting, thanks for checking that out! Hadn't occured to me that the disconnect can happen before going to sleep, that can mess with the counter.
I'll improve it and let you know
Awesome, let me know if you need logs or anything else.
I've merged all tickets related to this issue into a central pinned one: [#204]
Closing this one to keep it in one place.