Zigbee2MqttAssistant icon indicating copy to clipboard operation
Zigbee2MqttAssistant copied to clipboard

[BUG] renaming devices causes out of sync

Open philuxe opened this issue 5 years ago • 12 comments

I have renamed two of my devices using the assistant, then restarted the computer hosting the docker container. After the host reboot renamed devices are duplicated. Those that have been renamed are showing "NO COMPONENTS Maybe this device is not (yet) supported by Zigbee2Mqtt?" Some new devices entries are shown with the original friendly name (like before renaming)

To Reproduce

Steps to reproduce the behavior:

  1. rename some devices
  2. reboot the docker host
  3. see duplicated devices

Screenshots

Installation

  • Version of Zigbee2Mqtt: 1.7.1
  • Version of Zigbee2MqttAssistant: 0.3.105 (0.3.105+Branch.master.Sha.b1c45d4ca947b2701c12bdf7d0e8be4083a0a2fe)
  • Installation type (HASS.IO, Docker...): Docker

Screenshot_1

philuxe avatar Nov 28 '19 19:11 philuxe

Same issue here.

titomontes avatar Jan 03 '20 16:01 titomontes

Since Zigbee2Mqtt won't publish new Home Assistant Discovery topics for the renamed device. You need to reboot Z2M for that (I think this problem was never reports to Z2M).

Since Z2MA is using HA discovery topics for components, it's creating a fantom device with the old name.

The best way to fix this is to reboot Z2M.

carldebilly avatar Jan 03 '20 17:01 carldebilly

I'm also having this issue. I'm pretty sure that i did restart the Zigbee2Mqtt container after renaming the devices. I did this last night. Today during the day the fantom devices got added. I do see a pattern in that i renamed these devices and restarted the Zigbee2Mqtt & Zigbee2MqttAssistant containers after initiating the rename. I did it this way as i kept having trouble adding these devices to Z2M. I now remember what i did: i renamed the friendly_name of a newly discovered devices by manually editing the configuration.yaml file and then triggering a restart of the containers. If i look into the configuration.yaml file, i only see th devices with a correct friendly-name. I don't see additional incorrect fantom-devices in this yaml file. In the state.yaml file i see the fantom-devices added as the last few entries with only linkquality and last_seen attributes. I'm pretty sure it has got something to do with the configuration.yaml, state.json and database.db being out-of-sync.

GrumpyMeow avatar Jan 06 '20 20:01 GrumpyMeow

I think it's more a Z2M bug :-)

carldebilly avatar Jan 06 '20 21:01 carldebilly

Yes, you're right.. These are indeed Z2M configuration files. Thus it probably is more a Z2M bug.

GrumpyMeow avatar Jan 06 '20 21:01 GrumpyMeow

I have the same problem and I doubt that it's a Z2M bug. :see_no_evil: I've restarted Z2M and Z2MA and the phantom devices stay in my list: :thinking: Screenshot_20200123-002520

Even if it's a Z2M bug, an issue should be opened for it there...

@GrumpyMeow would you mind sharing your config files (configuration.yaml, state.json, database.db, possibly devices.yaml) here or at least the relevant parts of them indicating the out-of-sync state? I checked mine and they seem to be fine/sync.

CodeFinder2 avatar Jan 22 '20 23:01 CodeFinder2

Can someone having this issue try to reboot the host to see if it gets rid of phantom devices?

CodeFinder2 avatar Jan 25 '20 02:01 CodeFinder2

I have rebooted Mosquitto Server and Z2MA but having the same phantom devices...

ljpaff avatar Feb 05 '20 14:02 ljpaff

Yeah, I also rebooted virtually everything but it happens again. They appear and go away for no reason but most of the time, there are phantom devices listed. 😕

CodeFinder2 avatar Feb 05 '20 15:02 CodeFinder2

same issue

shirou93 avatar Sep 24 '20 12:09 shirou93

Same issue!

SPEC1AL1ST avatar Sep 25 '20 08:09 SPEC1AL1ST

I delete old devices topics on mqtt and restart z2massistant, Blank devices disappear.

shirou93 avatar Sep 25 '20 08:09 shirou93