Known device silently re-addressed after NWK conflict is never adopted: frames from new NWK dropped as "Unknown device", stale NWK persisted in zigbee.db until manual re-pair
I maintainer di solito rispondono entro 5 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 44/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend, networking
Direzione di ricerca
Start in the ControllerApplication receive path where packets are resolved from pkt.src and unknown devices are logged; then inspect how radio libraries pass sender EUI64 data and how appdb persists address changes. Trace the existing join handling and relevant packet tests before deciding where to add coverage. Done means a known device can be resolved from its EUI64 after an NWK change and the updated mapping persists across restart; bellows may also need to forward the sender EUI64.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
After the NCP reported an NWK (short address) conflict, a router device was silently re-addressed (0xB666 -> 0x5976). The coordinator knows the new mapping from the moment it assigns it — on every frame it emits incomingSenderEui64Handler with the device's EUI64 (the frames carry the APS_OPTION_SOURCE_EUI64 flag and the raw ASH frame contains the EUI64 bytes) — but zigpy resolves incoming frames by source NWK only, drops every frame as Unknown device, and never updates its database. The stale NWK persisted across a full HA restart, so all downlink traffic to the device failed (Failed to send request: device did not respond) for 5 days until the device was manually re-paired. Because the device was a router with 19 children, the whole subtree became unreachable.
This state arises in the wild without any deliberate action — e.g. after power outages or coordinator migrations when devices return on different NWKs (see home-assistant/core#115202 and #85881 in "Related issues" below).
Environment
- Home Assistant core 2026.10.4 (ZHA integration, config entry v5.2)
- zha 2.3.1, zigpy 2.3.0, bellows 1.1.0 (as pinned for HA 2026.10.4)
- Coordinator: SONOFF Zigbee 3.0 USB Dongle Plus V2 (Silicon Labs EFR32, EZSP via bellows)
- Affected device: Shelly 1PM plug (mains-powered router), IEEE
cc:ba:97:ff:fe:ec:28:e8
Evidence (timestamps UTC)
1. The conflict and the re-address (WARNING level, always logged)
2026-11-08 12:29:28.469 WARNING [bellows.zigbee.application] NWK conflict is reported for 0xb666
2026-11-08 12:29:28.469 WARNING [bellows.zigbee.application] Found cc:ba:97:ff:fe:ec:28:e8 device for 0xb666 NWK conflict: Shelly 1PM
2026-11-08 12:29:51.192 WARNING [zigpy.application] Unknown device AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x5976) # first of 180,074 warnings, continuing until 2026-11-13 21:37:12
The device's old NWK 0xB666 went completely silent at 12:29:28; frames from 0x5976 arrive from 12:29:51 onward (23 s later) — i.e. the NCP had already assigned and knew the new mapping at that point. (DEBUG logging was only enabled later, on 2026-11-10 22:37, which is why the EUI64-handler lines below are timestamped Nov 10–12; the WARNING-level "Unknown device" lines prove the packets were arriving from Nov 8 12:29:51.)
zigbee.db (devices_v15) at the end of the incident: ieee='cc:ba:97:ff:fe:ec:28:e8', nwk=46694 (0xB666), last_seen=2026-11-08 11:29 — never updated to 0x5976.
2. Proof that 0x5976 IS the Shelly (one packet, logged as adjacent frames, 2026-11-11 23:59:44)
[bellows.ash] Received frame DataFrame(... ezsp_frame=b'\x98\x94\x01b\x00\xe8(\xec\xfe\xff\x97\xba\xcc')
# trailing bytes e8 28 ec fe ff 97 ba cc = EUI64 little-endian = cc:ba:97:ff:fe:ec:28:e8 (inside the raw frame)
[bellows.ezsp.protocol] Received command incomingSenderEui64Handler: {'senderEui64': cc:ba:97:ff:fe:ec:28:e8}
# NCP reports the sender EUI64 of THAT frame
[bellows.ezsp.protocol] Received command incomingMessageHandler: {'type': INCOMING_UNICAST, 'apsFrame': EmberApsFrame(profileId=260, clusterId=2820, options=<...APS_OPTION_SOURCE_EUI64|APS_OPTION_DESTINATION_EUI64: 3392>, ...), 'lastHopRssi': -45, 'sender': 0x5976, 'messageContents': b'\x08\xcd\n\x05\x05!\xdbZ'}
# the message itself: sender NWK 0x5976, cluster 2820 (0x0B04 Electrical Measurement — a metering plug), SOURCE_EUI64 flag set
[zigpy.application] Received a packet: ZigbeePacket(... src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x5976), ... cluster_id=2820, lqi=220, rssi=-45)
WARNING [zigpy.application] Unknown device AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x5976)
# zigpy drops the packet on the failed NWK lookup...
[bellows.zigbee.application] Sending packet ... cluster_id=<ZDOCmd.IEEE_addr_req: 1>, data=Serialized[b'}v\x00\x00'] ...)
# ...and immediately broadcasts an IEEE_addr_req for 0x5976 ("who is 0x5976?") — no IEEE_addr_rsp ever arrives (0 occurrences in 5 days of logs)
So the NCP explicitly identifies 0x5976 as cc:ba:97:ff:fe:ec:28:e8 on every frame (raw bytes + incomingSenderEui64Handler + APS flag), while zigpy discards the frame because its own DB still maps that IEEE to 0xB666.
3. Stale record survives a full HA restart; downlink fails
2026-11-12 00:00:19.243 DEBUG [zha.zigbee.device] [0xB666](1PM): ... ping attempts have been exhausted, marking the device unavailable
2026-11-12 14:02:46.186 ERROR [homeassistant.components.automation...] Error for call_service at pos 1: Failed to send request: device did not respond
4. No join/announce was ever processed
In all DEBUG-enabled windows (from 2026-11-10 22:37 onward) while the device was actively transmitting as 0x5976, no trustCenterJoinHandler and no ZDO Device_annce for this IEEE was logged. (DEBUG was off during the conflict minute itself, 2026-11-08 12:29, so we cannot confirm whether an announce was emitted and missed, or never emitted by the device.)
Proposed fix
In zigpy's receive path (ControllerApplication frame handling, where the device is resolved from pkt.src NWK and Unknown device is logged), fall back to an EUI64 lookup when the radio library provides the sender EUI64: update device.nwk and persist via appdb. Currently NWK is only learned from handle_join (trust-center join / ZDO Device_annce). bellows may need a small companion change to forward the sender EUI64 on the packet object (today it is surfaced via the incomingSenderEui64Handler callback and the APS flag).
Healing time with the proposed fix
The device is mains-powered and transmits every ~2–5 s (metering reports; e.g. packets from 0x5976 at 22:37:54.8, 22:37:57.1, 22:37:59.9, 22:38:04.9, ...). With the EUI64 fallback in the receive path, the first frame after the re-address would update + persist the new NWK, so the mapping self-heals within seconds and downlink works from the next packet onward; persistence in zigbee.db means restarts don't regress. For sleepy battery devices it would heal on their next wake-up — still without any manual re-pair. Today, the same situation persists indefinitely (5 days here) until manual re-pair.
Workaround
Remove + re-pair the device in ZHA so it joins under its current address. A restart does not help (stale mapping is persisted in zigbee.db).
Related issues (checked, none cover this exact case)
- home-assistant/core#115202 — same observable symptom after a power outage (devices on unexpected NWK,
Unknown devicespam, "why doesn't the mesh heal?"), closed as not planned with no fix; this issue provides the concrete mechanism and a host-side fix that needs no device renegotiation. - home-assistant/core#85881 — DELIVERY_FAILED + NWK conflicts after coordinator migration; resolved by re-pairing.
- home-assistant/core#133627 — how to identify which device an unknown NWK belongs to (here bellows'
incomingSenderEui64Handler+ APS flag already provide the IEEE). - zigpy/bellows#465 — "NWK conflict is reported" is NCP-internal/informational; nothing propagates the re-address to zigpy.
- zigpy/zigpy#1943 (+PR #1944), zigpy/zha#981 — same-NWK rejoin cases; this is the changed-NWK-without-join/announce case.
- zigpy/zha#1004 — routers appearing available while downlink fails (symptom overlap, different mechanism).
Full debug logs around the incident and a zigbee.db snapshot are available on request.
Files
config_entry-zha-33c1fe7f00023439b042856580fb7e05-redacted.json
- Lingua principale
- Python
- Stelle
- 1.1k
- Fork
- 217
- Merge medio
- 7g 8h
- PR unite (30g)
- 26
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di zigpy/zigpy
-
bot: code audit
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 5 giorni
-
OTA: LEDVANCE (0x1189) bulb rejects 50-byte image blocks with MALFORMED_COMMAND after requesting 63 bytesForse già presa @zigpy-review-bot l’ha presa 10 giorni fa. Apertafirmware bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
zigpy/zigpy#1965 · 7 commenti ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 5 giorni
-
code quality
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 5 giorni
-
CatchingTaskMixin.catching_coro swallows CancelledErrorForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertacode quality
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 5 giorni
Issue simili
-
bug bugfix
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
simplify
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
drevendev/Devostasis#158 · 1 commento ·
-
Elko Super TR: temperature stops updating once the thermostat reports its active sensorForse già presa @zigpy-review-bot l’ha presa oggi. Apertabot: code audit
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
zigpy/zha-device-handlers#5790 ·
I maintainer di solito rispondono entro 1 giorno
-
source defect
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
mampfes/hacs_waste_collection_schedule#8269 ·
I maintainer di solito rispondono entro 1 giorno