jamiebegin / metrics2mqtt

Publish cross-platorm system performance metrics to a MQTT broker.
MIT License
63 stars 10 forks source link

Added a on_connect callback #5

Closed stegmannb closed 4 years ago

stegmannb commented 4 years ago

This PR tries to fix #4 and adds on_connect callback. If the connection could not be established an error message is logged.

It also fixes a problem I encountered with HomeAssistant autodiscovery where the config topic gets lost, because it is published before the connection is established. This may be because I use authentication or the broker is running on a slow system.

This is the first I am trying to contribute to an open source project and there may very well be a more elegant solution, so any feedback is appreciated.

jamiebegin commented 4 years ago

Thank you for the PR!

I'll go ahead and merge this. Thanks again for the contribution!