Luligu / matterbridge-zigbee2mqtt

Matterbridge zigbee2mqtt plugin
https://github.com/Luligu/matterbridge-zigbee2mqtt/blob/main/README.md
Apache License 2.0
63 stars 8 forks source link

Restart removes and adds devices #21

Closed copystring closed 3 months ago

copystring commented 3 months ago

Hi,

I'm using this with Google Home and noticed restarting matterbridge removes all the found devices and adds them again, resulting in a lot of notifications of my 126 zigbee devices. The devices also “forget” the room they were in after restarting matterbridge.

Surely this isn't the intended behavior. Could you take a look at this?

Luligu commented 3 months ago

Hi, thank you for your interest.

Matterbridge should not remove devices on restart unless:

This is because with some controllers would cause to loose automations and room configuration.

Let me know if this solved your issue or there is some bug.

copystring commented 3 months ago

Thank you. "unregisterOnShutdown": false, is set in the config and this is how it's set in the web interface: image

Sadly all devices are removed and added when restarting matterbridge

Luligu commented 3 months ago

Then something is wrong on your installation. Can you send me the log when Matterbidge remove the devices please ? From a little before you click restart. Also need you to be sure you are using the latest of both matterbridge and the plugin.

copystring commented 3 months ago

I have matterbridge 1.2.17 installed yesterday and installed matterbridge-zigbee2mqtt 2.0.14 via web interface yesterday as well.

Here is the debug log you need:

info - [21:34:21.701] [Matterbridge]: WebSocketServer client connected to Matterbridge
info - [21:34:21.705] [Matterbridge]: WebSocketServer received message => Connected to WebSocket: ws://192.168.1.106:8284
debug - [21:34:22.436] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '16' }
debug - [21:34:22.437] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.437] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '22.9' }
debug - [21:34:22.438] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.438] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'UNLOCK' }
debug - [21:34:22.438] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.439] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '83' }
debug - [21:34:22.439] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.441] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'externally' }
debug - [21:34:22.441] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.441] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'heat' }
debug - [21:34:22.441] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.442] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '0' }
debug - [21:34:22.443] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.445] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'idle' }
debug - [21:34:22.445] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.446] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'success' }
debug - [21:34:22.446] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.446] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'false' }
debug - [21:34:22.446] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.447] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'OFF' }
debug - [21:34:22.447] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.449] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '0' }
debug - [21:34:22.449] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.450] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '22.93' }
debug - [21:34:22.451] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.451] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'normal' }
debug - [21:34:22.451] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.451] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'measured' }
debug - [21:34:22.451] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.454] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '10' }
debug - [21:34:22.454] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.454] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '7' }
debug - [21:34:22.454] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.457] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '2024-05-28T19:34:22.361Z' }
debug - [21:34:22.457] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.457] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '76' }
debug - [21:34:22.457] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.459] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'idle' }
debug - [21:34:22.459] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.459] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '889787668' }
debug - [21:34:22.459] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.463] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'manual' }
debug - [21:34:22.463] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.467] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'OFF' }
debug - [21:34:22.467] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.468] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'HeizungHobbyraum' }
debug - [21:34:22.468] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.468] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'BTH-RA' }
debug - [21:34:22.468] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.468] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '0x18fc260000068686' }
debug - [21:34:22.468] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.468] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '47126' }
debug - [21:34:22.468] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.468] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'EndDevice' }
debug - [21:34:22.468] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.468] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '4617' }
debug - [21:34:22.468] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.468] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'Battery' }
debug - [21:34:22.468] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.475] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '1' }
debug - [21:34:22.481] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.481] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '5' }
debug - [21:34:22.481] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.481] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '8' }
debug - [21:34:22.481] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.481] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '1' }
debug - [21:34:22.481] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.481] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '20220627' }
debug - [21:34:22.481] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.481] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: '3.02.05' }
debug - [21:34:22.481] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
debug - [21:34:22.481] [HeizungHobbyraum]: MQTT message for device HeizungHobbyraum payload: { state: 'BOSCH' }
debug - [21:34:22.481] [HeizungHobbyraum]: Update endpoint 70 cluster 6-OnOff not found: is z2m converter exposing all features?
info - [21:34:23.431] [Matterbridge]: shutting down...
info - [21:34:23.443] [Matterbridge]: Shutting down plugin matterbridge-zigbee2mqtt
copystring commented 3 months ago

It does not remove the devices when shutting down. It does remove the devices when detecting the zigbee2mqtt devices on startup and then adds them again.

copystring commented 3 months ago

I made a video of the issue. I hope this shows the issue more precisely.

https://www.youtube.com/watch?v=hSnA4RR02i0

Luligu commented 3 months ago

So nothing is wrong with your log and in want I can understand with your video (btw that's a great idea!) Let me explain how a bridge works: Let say that everything is working fine on the controller side and Matterbridge side.

Then you shutdown Matterbridege:

Your restart Matterbridge:

In your case it seems that your controller (you may try to update if there is any) is not able to find the uniqueId and removes the old devices and creates new ones.

Unfortunately I cannot help you with the controller.

I will ask my friend Tamer Salah to eventually try to deal with your controller issue.

Luligu commented 3 months ago

Hi, we are still trying to understand.

Can you make a test please?

After controller and Matterbridge are running correctly, updates received and device controllable, don't touch Matterbridge but power off the controller, leave off for 1 minute, the turn it on again.

When it reconnects, do you see the same situation as before ? All devices at their place ?

copystring commented 3 months ago

Hi,

I tried this yesterday. I shut down the matterbridge completely and waited 10 minutes. No devices disappeared. When I started the matterbridge it behaved the same as in the video.

copystring commented 3 months ago

Oh wait. I misunderstood. I will try what you said later.

copystring commented 3 months ago

How can I power off the controller without stopping the matterbridge?

Luligu commented 3 months ago

I remember a problem like this with Apple Home and my homebridge zigbee2mqtt plugin.

Since I have more 100 devices in z2m I had for a few time a problem that was related to timing...

Let me know how the test goes..

copystring commented 3 months ago

What do you mean by restarting the controller? zigbee2mqtt itself or the matterbridge zigbee2mqtt?

Luligu commented 3 months ago

No I mean to turn the power off from your goggle controller. Don't touch anything else.

copystring commented 3 months ago

The host running matterbridge?

tammeryousef1006 commented 3 months ago

Power off your google home hub

On Wed, 29 May 2024, 9:22 pm copystring, @.***> wrote:

The host running matterbridge?

— Reply to this email directly, view it on GitHub https://github.com/Luligu/matterbridge-zigbee2mqtt/issues/21#issuecomment-2138011464, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO3B3TDZGNVQRHWA3TVEIATZEYMFZAVCNFSM6AAAAABIL2OJ4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZYGAYTCNBWGQ . You are receiving this because you were assigned.Message ID: @.***>

copystring commented 3 months ago

OK. I turned off all 6 of my google homes, waited a few minutes and turned on of them back on and waited a few more minutes. Nothing in the google home app on my phone changed. Everything stayed the same. Also, nothing changed in matterbridge.

tammeryousef1006 commented 3 months ago

next release solved this issue after testing and its very fast to load devices

copystring commented 3 months ago

Great! When do you expect the upcoming release?

tammeryousef1006 commented 3 months ago

its already under testing and the results so far is great , it will be during the next few days after several tests finished .