Koenkk / zigbee2mqtt

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

FW upgrade breaks Z2M (SONOFF DONGLE P) #23816

Closed tbrasser closed 3 weeks ago

tbrasser commented 3 weeks ago

What happened?

Referenced from reply on slightly different error.

Facing this after updating fw:

[13:19:54] INFO: Preparing to start...
[13:19:54] INFO: Socat not enabled
[13:19:55] INFO: Starting Zigbee2MQTT...
Starting Zigbee2MQTT without watchdog.
[2024-09-02 13:19:56] info:     z2m: Logging to console, file (filename: log.log)
[2024-09-02 13:19:56] info:     z2m: Starting Zigbee2MQTT version 1.40.0 (commit #unknown)
[2024-09-02 13:19:56] info:     z2m: Starting zigbee-herdsman (0.57.1)
[2024-09-02 13:19:56] info:     zh:zstack:znp: Opening SerialPort with {"path":"/dev/ttyUSB0","baudRate":115200,"rtscts":false,"autoOpen":false}
[2024-09-02 13:19:56] info:     zh:zstack:znp: Serialport opened
[2024-09-02 13:20:03] error:    z2m: Error while starting zigbee-herdsman
[2024-09-02 13:20:03] error:    z2m: Failed to start zigbee
[2024-09-02 13:20:03] error:    z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
[2024-09-02 13:20:03] error:    z2m: Exiting...
[2024-09-02 13:20:03] error:    z2m: Error: SRSP - SYS - stackTune after 6000ms
    at Object.start (/app/node_modules/zigbee-herdsman/src/utils/waitress.ts:59:23)
    at /app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:300:45
    at Queue.execute (/app/node_modules/zigbee-herdsman/src/utils/queue.ts:36:26)
    at /app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:1111:13
    at Queue.execute (/app/node_modules/zigbee-herdsman/src/utils/queue.ts:36:20)
    at ZStackAdapter.start (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:165:13)
    at Controller.start (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:138:29)
    at Zigbee.start (/app/lib/zigbee.ts:64:27)
    at Controller.start (/app/lib/controller.ts:140:27)
    at start (/app/index.js:154:5)

flashed the dongle with:

sudo podman run --rm --device=/dev/ttyUSB0 --privileged --group-add "$(stat --format=%g /dev/ttyUSB0)" -v /dev/:/dev/ -e FIRMWARE_URL=https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20240710.zip ckware/ti-cc-tool:2024-03-19 -ewv -p /dev/ttyUSB0 --bootloader-sonoff-usb
Resolved "ckware/ti-cc-tool" as an alias (/var/cache/containers/short-name-aliases.conf)
Trying to pull docker.io/ckware/ti-cc-tool:2024-03-19...
Getting image source signatures
Copying blob e0183997aaa7 done   | 
Copying blob 4abcf2066143 skipped: already exists  
Copying blob 2aa9be932802 done   | 
Copying blob c3cdf40b8bda skipped: already exists  
Copying blob 09f577b6635e done   | 
Copying blob ae52dd4ac952 done   | 
Copying blob 48d1cb2b9803 done   | 
Copying blob 4377ce580b2c done   | 
Copying blob 4f4fb700ef54 skipped: already exists  
Copying config 88726657f6 done   | 
Writing manifest to image destination
Downloading firmware from https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20240710.zip
Firmware source: 'CC1352P2_CC2652P_launchpad_coordinator_20240710.zip'
Firmware file:   'CC1352P2_CC2652P_launchpad_coordinator_20240710.hex'
sonoff
Opening port /dev/ttyUSB0, baud 500000
Reading data from CC1352P2_CC2652P_launchpad_coordinator_20240710.hex
Firmware file: Intel Hex
Connecting to target...
CC1350 PG2.1 (7x7mm): 352KB Flash, 20KB SRAM, CCFG.BL_CONFIG at 0x00057FD8
Primary IEEE Address: 00:12:4B:00:29:DE:23:D8
    Performing mass erase
Erasing all main bank flash sectors
    Erase done
Writing 360448 bytes starting at address 0x00000000
Write 104 bytes at 0x00057F988
    Write done                                
Verifying by comparing CRC32 calculations.
    Verified (match: 0xd9dd0124)

Originally posted by @tbrasser in https://github.com/Koenkk/zigbee2mqtt/issues/23785#issuecomment-2324499305

What did you expect to happen?

Running system

How to reproduce it (minimal and precise)

Flash with latest FW then try any version of Z2M

Zigbee2MQTT version

1.40, dev

Adapter firmware version

2024

Adapter

Sonoff dongle P

Setup

Home Assistant Addon

Debug log

No response

tbrasser commented 3 weeks ago

Cleaned up my config.yaml and did a full reboot of the system. Everything working fine now!

WizBangCrash commented 3 weeks ago

@tbrasser when you say "cleaned up my config.yaml" was there anything specific you did?

kenschbacher9 commented 3 weeks ago

@tbrasser when you say "cleaned up my config.yaml" was there anything specific you did?

@WizBangCrash : Did you get an answer or solve this issue? Unfortunately, I have the same problem and no solution yet.

tbrasser commented 3 weeks ago

I removed anything refering to cache/queue persisting. Uninstalled any addon targeting the same dongle (flasher addon(s)), and rebooted the entire system.

WizBangCrash commented 3 weeks ago

Thanks @tbrasser. I tried similar things. I think it was the cache/queue persisting change that finally got the updated firmware to work. TBH I'm not entirely sure what caused it to finally work as after the first day I stopped doing things logically and was in panic mode 🤣 I had to re-pair all my devices too. 50 of them and some in very inaccessible places. Lost two days of "Smart Home" and had a family threatening to put me out on the street 😱

Has definitely made me rethink my strategy of using more Zigbee devices though. Not a good experience. Especially the re-pairing as even after devices rejoined the network they would fall out again as I re-paired other devices.

I'm planning to get more than 3 hours sleep tonight now its working again 🥴

ethcz commented 4 days ago

I experienced the same issue. I have adapter Sonoff ZBDongle-P. I was running firmware CC1352P2_CC2652P_launchpad_coordinator_20230507 without issues. After flashing the firmware CC1352P2_CC2652P_launchpad_coordinator_20240710, the Z2M failed starting with the error: error: z2m: Error: SRSP - SYS - stackTune after 6000ms

After flashing 20230507 back, the error was still there. I also deleted coordinator_backup.json, database.db and state.json, but without any progress.

The only thing which helped was shrinking configuration.yaml to minimal configuration example and then Z2M started to work again. I was then putting back my previous additional configuration lines to configuration.yaml, ending up at the full previous configuration, which was failing right after the flashing of the firmware 20240710 for the first time.

Also I had to re-pair all devices.