Skip to content
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 a 'last will' availability topic to MQTT #87

Open
edrose opened this issue Jan 21, 2021 · 0 comments
Open

Add a 'last will' availability topic to MQTT #87

edrose opened this issue Jan 21, 2021 · 0 comments

Comments

@edrose
Copy link

edrose commented Jan 21, 2021

When integrating other third party consumers using MQTT, there is currently no way of knowing whether the EmonESP is online or not. I'm pulling data into my HomeAssistant instance and if the EmonESP goes offline, the last received value is assumed to still be correct. This causes things like integration functions to produce incorrect results with no indication that they are wrong.

This is commonly solved by adding an availability topic that indicates whether the device is online. When connecting to the broker, a 'last will' message can be provided which would be to set the availability topic to it's offline state. That means that the broker would send the offline availability payload if the connection unexpectedly closed.

The MQTT library used has support for this in it's connect() function, so it's a very minor change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant