[bug] Z2M recreates devices, creating duplicates
Version
Build/Run method
- [x] Docker
- [ ] PKG
- [ ] Manually built (git clone - npm install - npm run build )
Zwave2Mqtt version: 3.2.1 Openzwave Version: 1.6.1123
Describe the bug
When using the new ability to disable HASS discovery for devices (great addon), and changing the object_id of a device .. I eventually get a new device that i also need to disable discovery for. I guess Z2M checks if a device exists, by checking for a name/object_id combo?..
It's slightly cumbersome, and potentially a bug.
To Reproduce Steps to reproduce the behavior:
- Change a HASS device to
ignoreDiscovery - Change the
object_idof the HASS device (store the doc inbetween) - Do a node refresh / restart Z2M
- Observe that Z2M creates a new device
Expected behavior That devices did not get created again, at least not with discovery enabled..
I'm unsure how to resolve this.. maybe a different way to uniquely identify if a device has been created? Maybe let disabling discovery be for the node, and not a specific device?
Additional context N/A
I now have this. :)
I was clearing up leftovers (I thought) in MQTT, that HASS was re-discovering on every restart. While doing that, I checked up on the nodes in Z2M, and then I found the below. Note how the first half is disabled discovery, but the second half isn't... and that the second half has names with "_N" suffixes.

I guess Z2M checks if a device exists, by checking for a name/object_id combo
That should be unique and never be touched by the user
Yea, but I kinda needed to modify it to rid myself of the scaling that Z2M does.. :P
Anyhoo. Having one duplicate is fine.. but my last image shows that this happens for other devices as well, some I haven't modified.
Yea, but I kinda needed to modify it to rid myself of the scaling that Z2M does.. :P
I will fix this in #516 if you tell me what I have to fix. Like I said I don't have many devices to test and I would not break things
Having one duplicate is fine.. but my last image shows that this happens for other devices as well, some I haven't modified.
That's strange... I haven't edited anything in that part
Yea, but I kinda needed to modify it to rid myself of the scaling that Z2M does.. :P
I will fix this in #516 if you tell me what I have to fix. Like I said I don't have many devices to test and I would not break things
Oh, do note that #516 doesn't resolve this issue :).. #516 fixes a bug where only the first "rgb_dimmer" receives scaling - my issue here (and really always) is that they're scaled at all - but that we can't fix without breaking stuff. Sorry about the confusion ... :/
Having one duplicate is fine.. but my last image shows that this happens for other devices as well, some I haven't modified.
That's strange... I haven't edited anything in that part
I'll have to do more tests, rediscoveries, to see when they appear.