Zwave2Mqtt icon indicating copy to clipboard operation
Zwave2Mqtt copied to clipboard

[feat] Do not automatically add HA discovery data upon include

Open magpern opened this issue 5 years ago • 7 comments

Is your feature request related to a problem? Please describe. When you include a node, the node gets a id number. Eg. NodeID_16 If HASS Discovery is true, this entity will get written to MQTT as NodeID_16 the same instance it is included.

If you later change the name of the device in zwave2mqtt (or location) a new MQTT discovery topic is posted. This results in a lot of manual cleaning of MQTT.

Describe the solution you'd like

  • Alternative 1: A question after include. "Do you want to send Home Assistant MQTT Discovery topics?"

  • Alternative 2: Simply, do not send the topics. One have to manually request it, which is already available

  • Alternative 3: Clean up MQTT. If a node name changes, rename it and delete the old entries in MQTT, including the HASS Discovery topics

Describe alternatives you've considered One could disable the "HASS Discovery" temporarily, include, change name, enable again, and press the "re-discover device" But it is ease to forget this every time.

magpern avatar May 10 '20 20:05 magpern

Alternative 2: Simply, do not send the topics. One have to manually request it, which is already available

I think I could add an option like manual discovery that will allow you to manually send discovery once you are ready.

Usually I suggest to don't enable gateway once your entire configuration is ok to avoid this kind of issues

robertsLando avatar May 11 '20 09:05 robertsLando

I think I could add an option like manual discovery that will allow you to manually send discovery once you are ready.

This option is already there and works image

Usually I suggest to don't enable gateway once your entire configuration is ok to avoid this kind of issues Makes sense. However, I always remember this after I have included or changed a device :)

It is not a big deal, since it is fairly easy to remove the HASS topics with MQTT Explorer, but since, device is just included and name will change it feels like an unnecessary step to add the HASS topics, just to manually delete them in the next step (if you forget to set the MQTT Discovery to false).

So, it is not a bug, there is plenty of workarounds, but it feels like an extra step that could easily avoided, but like say a popup after the include. "Send Home assistant discovery topics now" (Yes / No)

magpern avatar May 11 '20 10:05 magpern

This option is already there and works

Maybe I have explained it wrong, with manual discovery I mean, it doesn't discover nodes automatically once nodes are detected but you always have to press that button in order to discover them

robertsLando avatar May 11 '20 13:05 robertsLando

@robertsLando I had some of these thoughts too, as this issue has. I resigned myself to just cleaning up in MQTT on renaming, but my comment can actually apply here too. If the default was to not do discovery, a button could instead be added to actually do it (push it to MQTT).

LordMike avatar May 11 '20 22:05 LordMike

I don’t use the location names for the topics and enjoy the fact that it automatically discovers when I add a new device. Just an alternative voice :)

travisghansen avatar May 20 '20 12:05 travisghansen

I'm about to add a whole pile of devices to my z-wave network, and would like to have them have somewhat sane names on the HA side. One idea would be to add an additional configuration option, basically "only send hass discovery if node has a name". If you have "use node names" AND "hass discovery" AND the new "only discover named nodes" enabled, the discovery will be created once the node gets a name, but not before. @robertsLando what do you think? I'm happy to put together a PR for this if that sounds like a useful approach.

vvuk avatar Dec 04 '20 04:12 vvuk

@vvuk I would be happy to review a PR for this. Anyway I suggest to add new features to: https://github.com/zwave-js/zwavejs2mqtt. That will be the future of this project. I will continue maintain this but would like to add features there and only fix bugs here. If you are asking for a 'why?' : https://github.com/zwave-js/zwavejs2mqtt#why-zwavejs

robertsLando avatar Dec 04 '20 08:12 robertsLando