-
Notifications
You must be signed in to change notification settings - Fork 36
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
Home Assistant discovery metadata #26
Comments
happy to consider this. perhaps this could be done as a generic discovery, not specific to ha? for example, the option might be something like this:
and the docs would include an explanation of what the 'config' looks like for each key. or a reference to the ha discovery spec. i'm a little anxious about sending a discovery message on every loop/archive. perhaps also have a mechanism to indicate how often the discovery info should be sent. |
Can you please explain how to enable Home Assistant auto discovery using the new mqtt.py developed? I have tried replacing the mqtt.py located in /usr/bin/weewx... but it doesn't work. |
The easiest way would be to download the updated branch from my repository
and add the needed configuration in your weewx.conf |
Thanks for your help and implementation @anastas78. I have correctly downloaded, installed and configured the weewx.conf. I have been able to read out_temp by including the following in the configuration.yaml
My question is, what should I expect by autodiscovery if I still need to define the variables in the configuration.yaml? Because if I not declare that, I don't receive anything. Maybe I am missing something? |
Have you added the HA specific configuration in weewx.conf under the [[MQTT]] label ?
so weewx-mqtt sends sensor data to "weather" topic and config data to "homeassistant/sensor/weewx/" (default topic if you have not changed your HA mqtt client configuration)
That is the idea - you don't have to define anything in HA. All sensors published by weewx-mqtt should be configured directly by the mqtt client of HA though the "ha_discovery_topic" topic. It should create a new device with the name you configure under "ha_device_name" and a bunch of sensors - your weexw sensors. |
Thank you @anastas78 for your variant. It works great. @matthewwall I think this would be a great addition to the Weewx mqtt plugin. It makes Home Assistant integration so much easier! |
Hello @timnis, |
Hello @anastas78 , |
@anastas78 Though this is working for me, I find that having a new discovery message pop in on every loop might be causing issues (for instance I'm seeing the availability flap in openHAB). Can the discovery topic be linked to just report generation? (edit: I blocked the HA discovery topic on my broker temporarily and sure enough the errors in the logs about going OFFLINE / UNKNOWN / ONLINE stopped. Adding that topic back into the aclfile immediately started the errors again.) |
@anastas78 When I run weewx before install your code I get... |
Would you be willing to accept a PR with changes to enable Home Assistant auto discovery?
Out of coincidence I saw that the fork by @anastas78 already has an implementation for this, I wonder if he/she wants to open a PR!?
See https://github.com/anastas78/weewx-mqtt
Best!
The text was updated successfully, but these errors were encountered: