Zwave2mqtt: [question] Retained Discovery

Created on 30 May 2020  Â·  21Comments  Â·  Source: OpenZWave/Zwave2Mqtt

Readme does not mention the function of the Retained Discover flag in the Gateway Settings. I'm unclear if this flag is causing devices which i've marked to be disabled from discovery, get rediscovered on rebooting zwave2mqtt or if I have found a bug. Please add a definition / usage for Retained Discovery.

Stale question

All 21 comments

Sorry I may miss that in the docs but yes with retained discovery your devices will be rediscovered even if disabled, you have to remove the retained message using mqtt explorer or other tools to clear up retained messages from the broker


Daniel

On 30 May 2020, at 21:20, teknomar7 notifications@github.com wrote:


Readme does not mention the function of the Retained Discover flag in the Gateway Settings. I'm unclear if this flag is causing devices which i've marked to be disabled from discovery, get rediscovered on rebooting zwave2mqtt or if I have found a bug. Please add a definition / usage for Retained Discovery.

—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub, or unsubscribe.

When you say "even if disabled"... are you talking about the Retained Discovery flag being disabled or disabling on an individual device? I see the retained flag in the broker, so I think I understand that part. I'm just not understanding what the function of the setting would be used for it the discovery ends up being retained either way. Appreciate the quick response and explanation though. I'll have to do some more trial and error testing either way.

I mean that if you have Retained Discovery available and you hit save, all devices discovery configuration will be retained at that point and even if you disable them they will be still retained. What you have to do is disable retain discovery and use mqtt explorer to remove retained messages


Daniel

On 31 May 2020, at 00:47, teknomar7 notifications@github.com wrote:


When you say "even if disabled"... are you talking about the Retained Discovery flag being disabled or disabling on an individual device? I see the retained flag in the broker, so I think I understand that part. I'm just not understanding what the function of the setting would be used for it the discovery ends up being retained either way. Appreciate the quick response and explanation though. I'll have to do some more trial and error testing either way.

—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub, or unsubscribe.

That you for the follow up explanation. Closing the issue.

Sorry to reopen this question on you, but I'm still not getting the expected behavior here. I sincerely appreciate your responses and don't feel any pressure to continue to respond since this might be user error.

  • I have auto discovery on, but retained discovery off. I want some devices discovered and some to be defined in the HA config manually.
  • I set a specific node to have discovery disabled, hit the store button. All topics for the node say disabled and persistent 'yes'.
  • I delete the entire node in MQTT Explorer so no topics can be retained. I delete the device from HA as well.
  • I restart zwave2mqtt (docker) and HA (docker), the node / topics shows back up in MQTT Explorer and is rediscovered in HA (which conflicts with the one I have defined in the HA config file).
  • Looking at the node in zwave2mqtt. Some of the topics continue to show as having discovery disabled / persistent yes... others switch back to discover enabled, persistent no. Looking at MQTT Explorer, I don't see anything showing as retained for that node/topics.

It seems most of the ones that flip back are related to scene topics. It also seems that the json is not correct for those topics because if I double-click them it says JSON Test failed. I'm unclear if the JSON has to be valid in order to disable discovery and persist that setting.

How can I get some devices to stop being discovered by HA on zwave2mqtt reboots, but also keep auto discovery enabled of HA for everything else?

I restart zwave2mqtt (docker) and HA (docker), the node / topics shows back up in MQTT Explorer and is rediscovered in HA

To be clear: if you set the disable discovery to a device it doesn't mean that those values will not be sent in mqtt but just that the discovery message is not sent (it means that the device will not be discovered in hass)

Yeah... I get that. I was just putting that there for additional context. I feel I've basically tried all sorts of methods to try to clear this, but no matter what I do... once I restart zwave2mqtt, some of the topics on the devices which I've set to disable discovery just end up switching back to enabled. It's not even the entire device... just specific topics within that device refuse to stay disabled. When I look at them in MQTT Explorer, they are showing retained again even though I completely deleted the device before marking discovery disabled in zwave2mqtt and "storing". Not sure if these values get cached anywhere else in the persistent volume attached to the docker container.

Could you show me a screenshot of mqtt explorer? Just to check if I have understand correctly what you mean

Here's an example of a dimmer switch at my Dinning Room Table. You see the topic is showing as retained which is the same for all those individual topics below it. What I did was delete the entire device called "Table" which trashes all the values underneath it.

image

Then in this picture, you can see that I switched everything back to disabled discovery, persist yes. And I delete the device from HA. But, when I restart zwave2mqtt... some of these topics revert back to discovery enabled, persistent no. And then everything shows back up in MQTT Explorer as retained again.

image

About the first picture, as I said, there is no error there as even if you disable discovery all values are sent via mqtt, the only way to stop this is to manually choose the values to send to mqtt from gateway values table.

About the second problem (disable discovery is not persistent after restarts) I need to investigate. COuld you please hit store button again before the restart?

Regarding your first comment... yes, I was expecting the devices to show back up in MQTT Explorer. The part I wasn't expecting was for the it to show "retained". Is that the expected behavior? In our previous discussion, you mentioned that the retained flag should be deleted for these topics, so my assumption was that the flag would not show back up even when the device does.

I hit the store button again and restarted zwave2mqtt... here is what it looks like after:
image

In order to remove retained from there you have to disable retain flag in mqtt settings too :)

If you're referring to the "retained discovery" option pictured below... I have that turned off.

image

Or are you talking about this one in the MQTT settings? That seems like it would cause other problems if I turn this one off, no? I only want to stop retaining discovery... I assume I still want to retain other messages or wouldn't current device states get screwed up when you restart things?

image

Or are you talking about this one in the MQTT settings? That seems like it would cause other problems if I turn this one off, no? I only want to stop retaining discovery... I assume I still want to retain other messages or wouldn't current device states get screwed up when you restart things?

Yes and yes. That option will remove retain flag from ALL messages sent from the Gateway (except for discovery). If you disable it the downside is that hass will lost state when refreshing the page (needs to receive a message in order to know it).

I think you are missing some things here, discovery is made by publishing messages to a specific topic (that can be3 confuigurable), in your case it will be homeassistant/.../config so you need to go to mqtt explorer and remove the retain flag from there, not the values

The config topics are there in MQTT Explorer under home assistant. These are a mix of what I'm leaving up to auto discovery and the stuff I have defined myself in the HA config file. The reason I'm even doing this is because these GE switch discoveries work fine for regular switches, but not for dimmers... so I end up having to change the payload and I understand how to define that better in the HA config file than in zwave2mqtt.

For example... here is the same device config in MQTT Explorer as defined in HA Config. This is what I want to keep and it works.

Anyway... I don't want to take up too much of your time. I'm pretty new at all this technology, but I'm also a developer / sys admin, so I thought some of these things would be easier to grasp. Maybe I'll figure it out eventually or just revert to defining everything in HA config.

Edited: The payload shown here is actually what is defined in zwave2mqtt, not what I have in the HA config file. Removed that part of my comment because I was looking at it incorrectly.

image

don't worry I just wanted to be sure there wasn't a bug or else with disable discovery as it's a feature introduced recently :)

I'll leave that to you to be the judge, but I still feel like the behavior isn't as expected since only some of the topic in zwave2mqtt revert back to discovery enabled after a restart, while others continue to show disabled for the same device. Seems like the store function isn't persisting all the topics past a reboot. Whether that is a symptom of my problem or not is something I can't say for certain.

That being said, I would rather just turn off HA discovery and be able to manually discover which nodes I want and have those retain the discovery. But, if I disable HA discovery altogether, the option to discover a node is removed on many of the devices (not sure if that's all or not... only attempted that once).

Anyway, appreciate the conversation and help and I'll keep cracking at it and see if I can get it functioning the way I want.

Since you just pushed an update, I would like to revisit this and explain why I now think this is actually a bug and not user error. Before updating my Docker image to the latest version you just released, I shut down my MQTT Docker container. Then I updated the zwave2mqtt container and waited for the zwave network to reboot. When looking at the dimmers I previously mentioned with problems, the same behavior appears... it shows that the first two topics for the device have auto discovery disabled / persist yes, but the other reverted back to auto discovery enabled / persist no. This can't be because of a retained message from the broker because the broker is not even running at this point. I subsequently disabled auto discovery and hit the store button again prior to starting up MQTT. When starting MQTT these devices were not rediscovered in HA, further proving the problem exists solely in the "store" mechanism in zwave2mqtt, or they would've reappeared in HA due to a retained discovery message.

So, from my vantage point, it seems not all the topics when disabled from discovery / stored, persist through a container restart as expected. I don't know why only two of the topics for the device persist, but this has been consistent with all the dimmers in which I do this.

If I get some free time, perhaps I will dig through the code or do more testing and see if I can determine a root cause. Just thought I'd provide additional feedback. Thanks!

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lsilva171 picture lsilva171  Â·  6Comments

larstobi picture larstobi  Â·  8Comments

LordMike picture LordMike  Â·  3Comments

billiaz picture billiaz  Â·  8Comments

twochannel picture twochannel  Â·  7Comments