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

Use mqtt retain flag for HA discovery message #38

Open
kki03 opened this issue Oct 28, 2024 · 0 comments
Open

Use mqtt retain flag for HA discovery message #38

kki03 opened this issue Oct 28, 2024 · 0 comments

Comments

@kki03
Copy link

kki03 commented Oct 28, 2024

Hi Markus,
I installed my Noah 2000 yesterday and also setup the HA integration. And now I was just looking into the HA discovery stuff and wanted to check how the sensors have been registered.

But I had to restart noah-mqtt to get the HA registration messages again.
E.g. topic: homeassistant/sensor/noah_0PV.../OutputPower/config
{ "name":"Output Power", "device_class":"power", "state_topic":"noah2mqtt/0PV...", "state_class":"measurement", "unit_of_measurement":"W", "value_template":"{{ value_json.output_w }}", "unique_id":"0PV..._output_power", "device": { "identifiers":[ "noah_0PV..." ], "name":"NOAH 2000", "manufacturer":"Growatt", "sw_version":"07.08.05.4004", "model":"NOAH 2000", "serial_number":"0PV..." }, "origin": { "name":"noah-mqtt", "sw_version":"0.0.24", "support_url":"https://github.com/mtrossbach/noah-mqtt" } }

It would be great if you could set the retain flag in method https://github.com/mtrossbach/noah-mqtt/blob/main/internal/homeassistant/service.go#L42 to true because that allows to read the messages from the mqtt server at any time.
E.g.
s.options.MqttClient.Publish(topic, 0, false, string(b))
would become
s.options.MqttClient.Publish(topic, 0, true, string(b))

Thanks
Klaus

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