Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.36k stars 1.62k forks source link

Joining new devices fails after a few days of uptime #3177

Closed sjorge closed 3 years ago

sjorge commented 4 years ago

Bug Report

What happened

I tried to join a new device, it failed.

The network/coordinator usb has been up for a about 1-1.5days now, joining new devices fail. Physically unplugging and replugging the usb (with z2m stopped ofcourse) re allows joining of new devices.

I did a capture of one of those failed join requests: https://pkg.blackdot.be/extras/zigbee/failed_join.pcapng

Not sure where it fails afterwards, it looks like z2m doesn't respond to the update device at all?

What did you expect to happen

The device to be able to join.

How to reproduce it (minimal and precise)

I can always reproduce this after a about 1-3 days after plugging in/out the USB device (rebooting the server does not help)

Debug Info

zigbee2mqtt version: 1.12.0-dev (commit #d52d520) CC253X firmware version: {"type":"zStack12","meta":{"transportrev":2,"product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190608}}

sjorge commented 3 years ago

I didn't switch back to the stock firmware, pairing still hits the odd timeout during interviewing/configuration but seems to be better once a few more routers had joined.

Koenkk commented 3 years ago

Can you try this firmware: CC2531ZNP-Prod_source_routing_20200728.zip

sjorge commented 3 years ago

I’m back at my old place for the night, will try to flash the new firmware tomorrow.

Small update, I got most things paired. Seemed to work smoother once I could pair through a router. With about 26 bulbs online (trådfri and Innr) the network does seem stable.

sjorge commented 3 years ago

I just updated to the new firmware, at first glance messages now seem to come in batches of 4-6 at a time per sec. Will give it a few days to see how it evolves but on first glance everything still works. If it stays table I'll try pairing a bulb in a week from now. Although I might need to reboot the server before that when I move it back into my rack.

sjorge commented 3 years ago

Only been a few days, but I paired 6 TuYa TS0201 Temp + Humidity sensors in a row, without much issue. They timeouts in pairing/interviewing are definitely better with the latest iteration. Now we wait a few more days.

Also out of interest, is the special fix for Hue Motion sensors in this firmware? Mine seems to drop out of the network occasionally. But I vaguely remember it not being in the 1.2 source routing one, so I think that is normal.

Koenkk commented 3 years ago

Good! The fix for end devices not being reachable is only in the zstack 3.x.0 firmwares, I can look into porting it to zstack 1.2 once we know if this issue has been fixed.

sjorge commented 3 years ago

Still working fine after 7 days so far.

sjorge commented 3 years ago

We've passed 14 days now, I will retest once more time hopefully all still good.

Still looks good!

Zigbee2MQTT:info  2020-08-16 16:10:07: Device '0x0017880104259333' joined
Zigbee2MQTT:info  2020-08-16 16:10:07: Starting interview of '0x0017880104259333'
Zigbee2MQTT:info  2020-08-16 16:10:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":{"friendly_name":"0x0017880104259333"},"type":"device_connected"}'
Zigbee2MQTT:info  2020-08-16 16:10:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"interview_started","meta":{"friendly_name":"0x0017880104259333"},"type":"pairing"}'
Zigbee2MQTT:info  2020-08-16 16:10:07: MQTT publish: topic 'zigbee2mqtt/0x0017880104259333/availability', payload 'online'
Zigbee2MQTT:info  2020-08-16 16:10:07: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"announce","meta":{"friendly_name":"0x0017880104259333"},"type":"device_announced"}'
Zigbee2MQTT:info  2020-08-16 16:10:09: Successfully interviewed '0x0017880104259333', device has successfully been paired
Zigbee2MQTT:info  2020-08-16 16:10:09: Device '0x0017880104259333' is supported, identified as: Philips Hue white and color ambiance E26/E27/E14 (9290012573A)
Zigbee2MQTT:error 2020-08-16 16:10:32: Failed to setup reporting for '0x0017880104259333' - Error: ConfigureReporting 0x0017880104259333/11 genOnOff([{"attribute":"onOff","minimumReportInterval":0,"maximumReportInterval":300,"reportableChange":0}], {"timeout":10000,"disableResponse":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null}) failed (Timeout - 46896 - 11 - 227 - 6 - 7 after 10000ms)
    at Timeout.waiter.timer.setTimeout [as _onTimeout] (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/utils/waitress.js:46:35)
    at ontimeout (timers.js:425:11)
    at tryOnTimeout (timers.js:289:5)
    at listOnTimeout (timers.js:252:5)
    at Timer.processTimers (timers.js:212:10)
Zigbee2MQTT:info  2020-08-16 16:10:32: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"interview_successful","meta":{"description":"Hue white and color ambiance E26/E27/E14","friendly_name":"0x0017880104259333","model":"9290012573A","supported":true,"vendor":"Philips"},"type":"pairing"}'

The error here is to be expected, as the hue bulb is on the latest firmware, which sadly means no reporting at all (even genOnOff)

sjorge commented 3 years ago

I did notice some weirdness though, I toggled the set of 4 panels again because they still were not all reporting genlevelCtrl... (#4109)

Zigbee2MQTT:info  2020-08-16 16:11:47: Successfully setup reporting for '0x14b457fffe2fee7a' - 1 - genOnOff
Zigbee2MQTT:info  2020-08-16 16:11:47: Successfully setup reporting for '0xec1bbdfffe189fde' - 1 - genOnOff
Zigbee2MQTT:info  2020-08-16 16:11:47: Successfully setup reporting for '0x14b457fffe301910' - 1 - genOnOff
Zigbee2MQTT:info  2020-08-16 16:11:47: Successfully setup reporting for '0xec1bbdfffe9f5f8f' - 1 - genOnOff
Zigbee2MQTT:info  2020-08-16 16:11:47: Successfully setup reporting for '0xec1bbdfffe189fde' - 1 - genLevelCtrl
Zigbee2MQTT:info  2020-08-16 16:11:47: Successfully setup reporting for '0x14b457fffe2fee7a' - 1 - genLevelCtrl
Zigbee2MQTT:info  2020-08-16 16:11:47: Successfully setup reporting for '0xec1bbdfffe9f5f8f' - 1 - genLevelCtrl
Zigbee2MQTT:info  2020-08-16 16:11:48: Successfully setup reporting for '0x14b457fffe301910' - 1 - genLevelCtrl
Zigbee2MQTT:info  2020-08-16 16:11:48: Successfully setup reporting for '0xec1bbdfffe189fde' - 1 - lightingColorCtrl
Zigbee2MQTT:info  2020-08-16 16:11:48: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"announce","meta":{"friendly_name":"office/lights/panel4"},"type":"device_announced"}'
Zigbee2MQTT:info  2020-08-16 16:11:48: Successfully setup reporting for '0xec1bbdfffe9f5f8f' - 1 - lightingColorCtrl
Zigbee2MQTT:info  2020-08-16 16:11:48: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"announce","meta":{"friendly_name":"office/lights/panel3"},"type":"device_announced"}'
Zigbee2MQTT:info  2020-08-16 16:11:48: Successfully setup reporting for '0x14b457fffe2fee7a' - 1 - lightingColorCtrl
Zigbee2MQTT:info  2020-08-16 16:11:48: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"announce","meta":{"friendly_name":"office/lights/panel2"},"type":"device_announced"}'
Zigbee2MQTT:info  2020-08-16 16:11:48: Successfully setup reporting for '0x14b457fffe301910' - 1 - lightingColorCtrl
Zigbee2MQTT:info  2020-08-16 16:11:48: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"announce","meta":{"friendly_name":"office/lights/panel1"},"type":"device_announced"}'

The network was pretty idle this time so I had hoped they might succeed, and they did. But the device_announcement and reporting setup log entries seem to be out of order?

Shouldn't we see the device_announcement first, then trigger the configuration of the device afterwards? Now this might be due to how the logging code works though, if we trigger the reporting in the onEvent for the device_accouncement we might do stuff before the later gets logged. Not super important, but confusing when going over logs none the less.

Anyway, I guess once you release a new official source_routing firmware, we can close this. (yay!)

Koenkk commented 3 years ago

It indeed depends on how the converters are called, the logging you see is from the bridgeLegacy extension. If you set the level to debug you should see it before.

I will try to release a new fw soon with this fix, thanks! (there is another issue but I forgot which, hope it pops up soon again)

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

sjorge commented 3 years ago

unstale, as AFAIK no updated firmnware has been released

FaBjE commented 3 years ago

Today I tried to join a sensor. But it failed. I tried several times (Next to the coordinator stick) After unplugging the coordinator stick it worked flawlessly the first time.

Unfortunately I was not logging debug information. I will try again in a week or so with debug logging.

Coordinator version: 20200728 (Source routing) Zigbee2Mqtt version: 1.14.3

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

sjorge commented 3 years ago

Unstale

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

MattWestb commented 3 years ago

Sjorge bump :-))

sjorge commented 3 years ago

Not much I can do here, I think koenkk just needs to publish the firmware with this and the hue motion fix, seems to be working fine for a while now.

MattWestb commented 3 years ago

I knowing. I was only liking the case not being closed :-)

Koenkk commented 3 years ago

@sjorge thanks, I will find some time to publish these firmwares soon since fixes appear to be stable now and no more changes are required.

Koenkk commented 3 years ago

Firmwares are available now: https://github.com/Koenkk/Z-Stack-firmware/tree/develop/coordinator/Z-Stack_Home_1.2/bin

skumka commented 3 years ago

@Koenkk Hi, Problem exist also for Usb cc2538+cc2592 with antenna. It does not seem to be a firmware problem.