-
Notifications
You must be signed in to change notification settings - Fork 10
Improve MQTT connection failure handling #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
miaucl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, this looks like quite some improvements. I admit, I also had some issues with it but nothing to annoying to motivate me to go over it. Appreciate your effort and I will surely test it but it looks already quite nice. There are just two minor details open.
- typo
- the mypy workflow seems to have a problem with the mqtt library callback version
|
Hi, thanks for your comments. |
Thx, you too :) Did not know they are outdated. Good to know as i will have to Patch my other libs as well. Will test it in the following days but looks good👍 |
…rom callback API V1 return code
…nection to the broker
…status, linux and linux2mqtt versions added to device
20b14a7 to
987e685
Compare
|
Had to fix another problem first #82 and rebased your PR afterwards. It will also be >=3.12 from here on, as psutil changes quite significantly between the versions. @Endymion78 Could you please verify again on your side as well that everything still works as you intend? |
miaucl
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Builds and runs on my test setup!
|
I confirm that everything is OK on my end as well. |
Previously, linux2mqtt stopped if MQTT broker was unavailable on startup.
Also, metrics online statuses were sent on first connection to MQTT broker only, so metrics stayed offline in case of broker restart.
This proposal modifies the code to avoid stopping execution if connection to the MQTT broker can't be established on startup and to send online statuses when establishing connection.
Discovery topics are also modified so each metric availability depends on the metric status and linuxmqtt status and to add
linux and linux2mqtt versions to device in discovery topics.
Troubleshooting is made easier by adding optional logging to directory with --logdir command line parameter and improving MQTT connection events logging