reverieline / CC2538-CC2592-ZNP

Z-Stack 3.0.2 minimal coordinator building patch for CC2538-CC2592 module
MIT License
69 stars 30 forks source link

Reconnecting devices to the zigby network after a power outage. #9

Open JerryLutor opened 3 years ago

JerryLutor commented 3 years ago

Help me understand the reason: if the power on the stick is lost, then the network may not be restored at all or it will be resolved partially. The stick is used through a 2 mctt zigbia. The devices connected to it are: 1) switch without zero line 2) sockets that act as routers. 3) xiaomi sensors (motion and opening sensors)

Is this the reason in the firmware of the whistle, the zigby itself is 2 mktt or is it "normal" and this is how the zigby network works?

To restore the network, you need to reconnect the device through pairing

aromanro commented 3 years ago

I've got a report from somebody using different software that has the a similar issue with this firmware.

When restarted, 'no route' errors (AF data notifications, status 0xCD) are received if trying to reach the network devices and the resolution is to re-pair the devices.

As for the question above: " is it "normal" and this is how the zigby network works?" the answer is:

No, it's not the normal way. The network should not be affected by a restart. All that is relevant should be stored in the persistent memory.

tsmt09 commented 3 years ago

@JerryLutor @aromanro I had the same issues using zigbee2mqtt with docker. I did two changes to my config in one step, so I don't know what solved it.

Also, I didn't lose all of my devices, it was just some. I use an Aqara, Tradfri and Sonoff mix of devices.

First: move from docker verison to native installation on raspbian

Second:

advanced:
    network_key: GENERATE

The zigbee2mqtt documentation states that you should set this value on your first startup to generate a network_key.

After both changes, power disconnects or reboots are not a problem anymore. I don't know if the network_key does have anything to do with it, but maybe zigbee2mqtt overwrites the one on the device, if no value is set there.

aromanro commented 3 years ago

In the case I mentioned, zigbee2mgtt is not used so it does not apply. Neither is docker. I'll check zigbee2mqtt sources to see how they handle that setting, to see if that helps somehow.

I've got informed of yet another one that has a similar issue with the firmware. I don't know what software he uses, though, the info came through an intermediary.

aromanro commented 3 years ago

I briefly checked the zigbee2mqtt sources, 'GENERATE' just generates a random network key. I don't see how this would solve the problem. The code I mentioned sets the network key each time it starts (so does the zigbee2mqtt is you set a key there instead of 'GENERATE').

aromanro commented 3 years ago

I didn't lose all of my devices, it was just some. I use an Aqara

@TobiasSchmitt09 You mentioned that you lost only some devices. Are those by chance Zigbee 3 devices and the others 'legacy' ones? I'm trying to narrow down what is lost in the case of power loss.

tsmt09 commented 3 years ago

I don't see how this would solve the problem.

Yup sure, I'm not familiar neither with codebase of the devices firmware nor zigbee2mqtt. It's just the observations I made because I thought they might help.

You mentioned that you lost only some devices.

Specifically I use those devices (I'll link zigbee2mqtt documentation links because they have all the devices in their list)

Aqara https://www.zigbee2mqtt.io/devices/WSDCGQ12LM.html (Temperature Sensor) https://www.zigbee2mqtt.io/devices/MCCGQ11LM.html (Window contact)

SonOff https://www.zigbee2mqtt.io/devices/SNZB-04.html (temp. sensor) https://www.zigbee2mqtt.io/devices/SNZB-02.html (wind. contact)

Tradfri: https://www.zigbee2mqtt.io/devices/E1525_E1745.html (motion sensor) https://www.zigbee2mqtt.io/devices/E1746.html (repeater)

codm repeater: https://shop.codm.de/automation/zigbee/23/zigbee-cc2530-cc2592-long-range-router/repeater?c=10

Before making the two mentioned changes, I observed problem with all of the devices, except the Aqara temperature sensors.

morgenroth commented 3 years ago

Any news on this issue?

On every power-loss of my CC2538 board, these errors appear in zigbee2mqtt and nothing works anymore.

Jan 13 17:40:10 bumblebee npm[372]: Zigbee2MQTT:error 2021-01-13 17:40:10: Publish 'set' 'current_heating_setpoint' to 'Bath OG Thermostat' failed: 'Error: Command 0x5c0272fffec1282b/1 manuSpecificTuya.setData({"status":0,"transid":0,"dp":2,"datatype":2,"length_hi":0,"length_lo":4,"data":[0,0,0,195]}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null}) failed (Data request failed with error: 'Timeout' (9999))'
Jan 13 17:40:10 bumblebee npm[372]: Zigbee2MQTT:debug 2021-01-13 17:40:10: Error: Command 0x5c0272fffec1282b/1 manuSpecificTuya.setData({"status":0,"transid":0,"dp":2,"datatype":2,"length_hi":0,"length_lo":4,"data":[0,0,0,195]}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null}) failed (Data request failed with error: 'Timeout' (9999))
Jan 13 17:40:10 bumblebee npm[372]:     at ZStackAdapter.<anonymous> (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:339:27)
Jan 13 17:40:10 bumblebee npm[372]:     at Generator.next (<anonymous>)
Jan 13 17:40:10 bumblebee npm[372]:     at fulfilled (/opt/zigbee2mqtt/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:24:58)
Jan 13 17:40:10 bumblebee npm[372]: Zigbee2MQTT:info  2021-01-13 17:40:10: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"Publish 'set' 'current_heating_setpoint' to 'Bath OG Thermostat' failed: 'Error: Command 0x5c0272fffec1282b/1 manuSpecificTuya.setData({\"status\":0,\"transid\":0,\"dp\":2,\"datatype\":2,\"length_hi\":0,\"length_lo\":4,\"data\":[0,0,0,195]}, {\"timeout\":10000,\"disableResponse\":false,\"disableRecovery\":false,\"disableDefaultResponse\":true,\"direction\":0,\"srcEndpoint\":null,\"reservedBits\":0,\"manufacturerCode\":null,\"transactionSequenceNumber\":null}) failed (Data request failed with error: 'Timeout' (9999))'","meta":{"friendly_name":"Bath OG Thermostat"},"type":"zigbee_publish_error"}'
Jan 13 17:40:19 bumblebee npm[372]: Zigbee2MQTT:error 2021-01-13 17:40:19: Publish 'set' 'current_heating_setpoint' to 'Jonas Thermostat' failed: 'Error: Command 0x5c0272fffec73db4/1 manuSpecificTuya.setData({"status":0,"transid":1,"dp":2,"datatype":2,"length_hi":0,"length_lo":4,"data":[0,0,0,210]}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null}) failed (Data request failed with error: 'No network route' (205))'
Jan 13 17:40:19 bumblebee npm[372]: Zigbee2MQTT:debug 2021-01-13 17:40:19: Error: Command 0x5c0272fffec73db4/1 manuSpecificTuya.setData({"status":0,"transid":1,"dp":2,"datatype":2,"length_hi":0,"length_lo":4,"data":[0,0,0,210]}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null}) failed (Data request failed with error: 'No network route' (205))

My only solution for now is to re-pair all devices.

aromanro commented 3 years ago

"Data request failed with error: 'No network route'"

That's the same error that was signaled with my implementation.

Can somebody try to wake up the devices (press some buttons on them or something, to force them to send notifications/reports) to see if the routing isn't rebuilt?

drgrandios commented 3 years ago

"Data request failed with error: 'No network route'"

That's the same error that was signaled with my implementation.

Can somebody try to wake up the devices (press some buttons on them or something, to force them to send notifications/reports) to see if the routing isn't rebuilt?

I have the same error, 21 devices, 4 of them are (IKEA) remotes, the rest are lights. Only the remotes will reappear - especially when removing the battery for a short time. All lights only come back to life after a reset (loosing all group memberships and scenes, unfortunately...).

codmpm commented 3 years ago

I've tested all for me know variants of the firmware and all have the same problem:

zigbee2mqtt 1.17.0 zigbee-herdsman 0.13.46 cc2538+cc2592 from Duoweisi on cod.m's CC2538 RPi module (UART)

Revision cold reboot reboot reboot + wait z2m restart comment
revierline 20200327 no no no yes without SBL
jethome 20201010 no no no yes with SBL
modkam 20200211 no no no yes with SBL

Is it confirmed that the USB variants of the CC2538 have the same issue?

Sorry to link out of the issue, but we have a discussion about this behaviour with different firmwares over at the homegear forums: https://forum.homegear.eu/t/cc2538-und-cc2530cc2592-zigbee-raspberry-pi-modul/3572/51

Cheers, Patrik