Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devices lost after hassio zigbee2mqtt restart #2908

Closed
autopower opened this issue Feb 7, 2020 · 7 comments
Closed

Devices lost after hassio zigbee2mqtt restart #2908

autopower opened this issue Feb 7, 2020 · 7 comments

Comments

@autopower
Copy link

autopower commented Feb 7, 2020

Bug Report

Environment:
Hassio on Synology, docker, supervisor 199, HA 105.2
Z2M add on, 1.10.0
CC2530 connected to ESP8266, EspEasy as serial server
Looks like similar issue: #1657 but there is no interference

What happened

All devices are lost after z2m addon restart. If device is successfully joined (see logs attached) and Z2M addon is restarted, connection to device(s) is/are lost and device(s) not reporting correct values (old values or unavailable) to hassio.
Same issue with ZStack 1.2 without source routing or ZStack 3, no problems if Z2M addon is not restarted, device(s) are present in HA and responsible, reporting correct values,

What did you expect to happen

Device joined after restart automatically without manual rejoin.

How to reproduce it (minimal and precise)

  1. Start Z2M addon
  2. join device
  3. use device, everything is reported ok
  4. restart Z2M addon
  5. communication with device lost

Debug Info

zigbee2mqtt version: 1.10.0
CC2530 firmware version: Z-Stack_Home_1.2 with source routing
ESPEasy: ESP_Easy_mega-20191208_normal_ESP8266_4M1M
Device: Xiaomi, as stated in log
same issue with Ikea Tradfri bulb, LED1624G9
after-restart.txt
configuration.txt
succ_join.txt

herdsman log after pressing button on Xiaomi:
herdsman.txt

@Koenkk
Copy link
Owner

Koenkk commented Feb 7, 2020

It looks like your database.db file is cleared on every restart, can you verify this?

@autopower
Copy link
Author

autopower commented Feb 7, 2020

Yes, database.db is cleared (size set to zero) on every start. Only coordinator entry (id: 1) is present after restart.
Docker container rights to /share folder are rw. Logs are flawlessly written into folder.
database-after-restart.txt
database-before-restart.txt

@Koenkk
Copy link
Owner

Koenkk commented Feb 7, 2020

Can you switch the the edge addon and set zigbee_herdsman_debug to true after that start zigbee2mqtt and provide the log

@autopower
Copy link
Author

autopower commented Feb 7, 2020

Edge addon working ok after 1st restart, logs attached (docker log export, in csv format):
before restart-addon_7ad98f9c_zigbee2mqtt_edge.txt
after restart-addon_7ad98f9c_zigbee2mqtt_edge.txt
What is the cause of the problem?

edit: after second restart same behaviour = devices lost and devices.db truncated to only 1 record (coordinator), log attached
second restart-addon_7ad98f9c_zigbee2mqtt_edge.txt

@Koenkk
Copy link
Owner

Koenkk commented Feb 7, 2020

Something goes wrong with the network key, could it be that the network_key you specified is too long? Should be 16 values (https://www.zigbee2mqtt.io/how_tos/how_to_secure_network.html#change-zigbee-network-encryption-key)

@autopower
Copy link
Author

autopower commented Feb 7, 2020

Oh, my fault! not 16 but 20!!! bytes! Let me check if its working in edge and/or "normal" release.
edit: on edge working, on 1.10.0 release working.
solution: if database.db is truncated after restart to only one id (coordinator) please check network_key in configuration.yaml if contains 16 values as stated in https://www.zigbee2mqtt.io/how_tos/how_to_secure_network.html#change-zigbee-network-encryption-key

Koenkk added a commit to Koenkk/zigbee-herdsman that referenced this issue Feb 8, 2020
@Koenkk
Copy link
Owner

Koenkk commented Feb 8, 2020

Fixed now, zigbee2mqtt will refuse to start when an incorrect length is set. (and print an error message about it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants