-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add LWT to mqtt connection #35
base: master
Are you sure you want to change the base?
Conversation
@roe-dl would you mind testing this? It's pretty straight forward and works as intended in my setup. |
I tested it. For that I used a simple WeeWX installation including the driver to fetch the weather data from my weather station and the MQTT extension in patch-1 version.
So I guess, it works as it should do. |
@roe-dl your test is way more detailed than my own. Everything sounds exactly as it should. Amazing, thank you.
Fyi: This is MQTTs lwt feature at its best. When the client disconnects cleanly, "offline" is set by the broker right away. If the client dies off, the broker publishes "offline" after a certain timeout. |
One question: Why is the topic called "lwt"? I found it not really intuitive. What about "connection" or "server"? Together with the possible values "offline" and "online" those names would be self explaining, I guess. |
It's an established topic name used by many project. However, I agree with you. |
@matthewwall ready to merge |
Added one improvement where the broker would eventually decide to mark as offline and the running weewx wouldn't care. |
So just to be clear, even though I have installed the autodiscovery variant of weewx-mqtt, I should declare this LWT in the configuration.yaml because otherwise I cannot "discover" anything. Am I doing right? Or i'm missing something? |
Fixes #21
For testing in Home Assistant: