yllibed / Zigbee2MqttAssistant

GUI for Zigbee2Mqtt running in docker and HASS.IO
449 stars 42 forks source link

[BUG] renaming devices causes out of sync #130

Open philuxe opened 4 years ago

philuxe commented 4 years ago

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

Screenshot_1

titomontes commented 4 years ago

Same issue here.

carldebilly commented 4 years ago

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.

GrumpyMeow commented 4 years ago

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.

carldebilly commented 4 years ago

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

GrumpyMeow commented 4 years ago

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

CodeFinder2 commented 4 years ago

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 commented 4 years ago

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

ljpaff commented 4 years ago

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

CodeFinder2 commented 4 years ago

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. 😕

shirou93 commented 4 years ago

same issue

SPEC1AL1ST commented 4 years ago

Same issue!

shirou93 commented 4 years ago

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