Add stand-alone script to generate and publish Home Assistant discovery messages #927
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a stand-alone Python script to generate and publish Home Assistant discovery messages to MQTT broker based on the files with the current meter readings and on the driver templates.
Motivation:
The current approach to provide Home Assistant discovery is implemented via a Home Assistant add-on. However, only some Home Assistant installation methods allow the users to install add-ons. For example, when using Home Assistant Core or Home Assistant Container, the option of installing and using add-ons is unavailable.
In addition, if I understand correctly, the current way of performing the Home Assistant discovery relies on explicit definition of every meter in a configuration file. The wmbusmeters application can, however, use wildcards for specifying meter IDs. This allows defining multiple similar meters in a single file. I believe that such a feature significantly improves user experience and that it should be utilized by the Home Assistant discovery procedure as well.
If you find this script useful, feel free to merge it.