Repository navigation
Emit INITIALIZED after rebuilding a reinterviewed device - #987
TheJulianJES wants to merge 2 commits into
Conversation
A re-commissioned Green Power device goes through the reinterview rebuild, which only emitted CONFIGURED. The pairing UI shows that as "Initializing" and never completes. Finish with INITIALIZED, like a join does.
INITIALIZED after rebuilding a reinterviewed device
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #987 +/- ##
=======================================
Coverage 97.58% 97.58%
=======================================
Files 61 61
Lines 10870 10871 +1
=======================================
+ Hits 10607 10608 +1
Misses 263 263 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
zigpy-review-bot
left a comment
There was a problem hiding this comment.
Looks good: _async_device_reinterviewed now ends with CONFIGURED then INITIALIZED, matching the join path (async_device_initialized / _async_device_joined), and a failed rebuild still returns before emitting either.
Verified (4 checks)
- The emit loop sits after the
all_succeededearly return, so the failure path is unchanged (zha/application/gateway.py:611-630). - It covers both the in-place rebuild and the quirk-swap branch, since both fall through to the same emit.
tests/test_gateway.pyandtests/test_green_power_device.pypass at this head (87 passed).- The
full[2:]assertion in the GP test does check the second (in-place) recommission, not the first.
Minor, no change needed: new_join stays False on both events, whereas the join path sends new_join=True on CONFIGURED only. That matches the swap-test docstring (HA repoints its device proxy off the first event), so it's consistent.
|
@zigpy-review-bot review as non-trivial PR, check logic, check in HA, and so on. Why does this go through reinterview btw when it's just reset by the user and rejoining whilst the "add device" page is open? Is this just for ZGP? We don't clear attribute cache and do a full re-interview for other devices doing this, right? |
|
Re-reviewed at a459434 as a non-trivial PR (logic traced through zigpy dev and the HA Core handler, tests run in a worktree). No blocking findings, the earlier approval stands. Why a re-pair goes through the reinterview pathIt doesn't, for Zigbee devices. It's Green Power only.
Logic
Check in HARead against HA Core dev
Tests
Nit (non-blocking)The new comment says "a GPD is re-commissioned from the pairing UI" but the code runs for every reinterview. The PR body covers that, so it could say "also reached by Reconfigure". |
Proposed change
Re-pairing an already known Green Power device leaves its card on the Add Device page stuck at "Configuration complete / Initializing".
zigpy announces a re-commissioned GPD as
device_reinterviewed, so it goes through_async_device_reinterviewed. That path only emitsDeviceFullInitEvent(CONFIGURED). The frontend showsCONFIGUREDas "Initializing" and only completes the card onINITIALIZED, which never comes. A first commissioning goes throughasync_device_initializedinstead, which emitsCONFIGUREDand thenINITIALIZED.This PR makes the reinterview rebuild end with
INITIALIZEDas well, afterCONFIGURED, for both the in-place rebuild and the device swap. A failed rebuild still emits neither.The swap test in
tests/test_gateway.pyand the GP re-commission test intests/test_green_power_device.pyasserted theCONFIGURED-only sequence; both now expectCONFIGURED,INITIALIZED. The GP test also checks the in-place rebuild, which is the case a GPD without a quirk hits. Both tests fail ondev.Additional information
Seen with a SENIC/GIRA Friends of Hue switch (EnOcean PTM 215Z) on EZSP: the first commissioning completed the card, every re-commissioning after that stuck at "Initializing".
The
CONFIGURED-only emit dates back to #755. Before GP support (#868), only a Reconfigure-triggered reinterview reached it, with the Add Device page closed, so it wasn't visible. A Reconfigure-triggered reinterview now also emitsINITIALIZED; HA only records the pairing status from it and forwards it to the frontend.Related, but a different path: #981 (a known Zigbee device rejoining with the same NWK never reaches ZHA at all).