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

Set retain flag on configuration messages? #240

Closed
gutermhub opened this issue Aug 25, 2021 · 2 comments
Closed

Set retain flag on configuration messages? #240

gutermhub opened this issue Aug 25, 2021 · 2 comments
Assignees

Comments

@gutermhub
Copy link

It could be helpful to set "retain" flag on homeassistant configuration messages.
Now they are not retained, which means that ring-mqtt needs to be restarted a couple of times for devices to be properly discovered and configured.
Running ring-mqtt with mosquitto and openhab mqtt broker (which natively supports homeassistant auto-discovery and configuration).
And thank you, awesome piece of software!!

@sktaylortrash
Copy link

This seems like a bad idea to me. Especially, given that these are supposed to be dynamic.
It sounds more like an OpenHab issue as I have multiple HA installs and have never once needed to publish discovery objects multiple times.
If it were implemented I'd hope it was configurable to be not enabled.

@tsightler
Copy link
Owner

tsightler commented Aug 26, 2021

As noted in the documentation, the script monitors for Home Assistant birth/last will messages which publish online/offline message to homeassistant/status topic so it knows to resend config and state data on Home Assistant restart. I'm sure you could make an automation to get OpenHAB to do the same (since you are using Home Assistant discovery I could argue that not providing compatible online/offline status is really an OpenHAB issue), or maybe OpenHAB also supports birth/last will messages although right now the script is hard coded to only look for them on the homeassistant/status topic and the legacy hass/status topic. In the past I used to allow the status topic to be configured but I removed that quite a long time ago as the vast majority of people just used the default and I don't like having tons of unused features.

In general, the problem with setting the retain flag on discovery messages is two fold:

  1. It creates a mess when people want to stop using something, as users will have to manually clean the entries from their MQTT broker and minor changes are also more difficult. For example, the recent ID changes were a minor annoyance that required just a restart of HA to resolve, but would have been far more trouble for users if the discovery messages were retained.

  2. Even if the discovery messages are retained, you would still need to signal to the script to update state for all devices since state messages are not retained either.

When I first started this project I used retain for a few things and it was just a nightmare and I learned to hate it from a support perspective, so I just don't have any desire change it at this point as this project is too widely used and generates very few issues.

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

3 participants