Zwave2Mqtt icon indicating copy to clipboard operation
Zwave2Mqtt copied to clipboard

[bug] Z2M recreates devices, creating duplicates

Open LordMike opened this issue 5 years ago • 5 comments

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:

  1. Change a HASS device to ignoreDiscovery
  2. Change the object_id of the HASS device (store the doc inbetween)
  3. Do a node refresh / restart Z2M
  4. 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

LordMike avatar May 23 '20 22:05 LordMike

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.

image

LordMike avatar May 25 '20 08:05 LordMike

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

robertsLando avatar May 25 '20 09:05 robertsLando

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.

LordMike avatar May 25 '20 09:05 LordMike

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

robertsLando avatar May 25 '20 09:05 robertsLando

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.

LordMike avatar May 25 '20 10:05 LordMike