fix(z2m): Resolve AttributeError 'original_name' on DeviceEntry in Zigbee2MQTT provider#643
fix(z2m): Resolve AttributeError 'original_name' on DeviceEntry in Zigbee2MQTT provider#643firstof9 wants to merge 6 commits into
Conversation
…gbee2MQTT provider
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #643 +/- ##
==========================================
+ Coverage 84.14% 92.73% +8.58%
==========================================
Files 10 40 +30
Lines 801 4306 +3505
Branches 0 30 +30
==========================================
+ Hits 674 3993 +3319
- Misses 127 313 +186
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ox lock providers
…ut resilience Z2M uses 0-based user indices while Keymaster uses 1-based slot numbers, causing codes to be written to the wrong physical slot (off by one). Changes: - _async_query_slot: sends Z2M user index = km_slot - 1 - handle_state_message (bulk users): converts Z2M index + 1 → km slot - handle_state_message (single pin_code): converts Z2M user + 1 → km slot - handle_state_message (action_user): converts Z2M user + 1 → km slot - async_set_usercode: sends Z2M user = km_slot - 1 - async_clear_usercode: sends Z2M user = km_slot - 1 - _async_handle_action: re-query uses Z2M user = km_slot - 1 - _async_query_slot: on timeout, fall back to cached value if available instead of always raising LockOperationFailed; improves resilience on slow or unreliable hardware (e.g. old Zigbee adapters) Fixes FutureTense#641 (slot offset), reported by hendricksond
Strict Line-by-Line Code Review — PR #643
📄
|
Replaces bare version tags with immutable commit SHA pins for security and reproducibility. Also bumps to latest available major versions: - actions/checkout: v4 → v6.0.3 (df4cb1c) - actions/setup-python: v5 → v6.2.0 (a309ff8) - astral-sh/setup-uv: v5 → v8.2.0 (fac544c) - actions/upload-artifact: v4 → v7.0.1 (043fb46) - actions/download-artifact: v4 → v8.0.1 (3e5f45b) - codecov/codecov-action: v5 → v7.0.0 (fb8b358) - softprops/action-gh-release: v2 → v3.0.0 (b430933)
Summary
This PR resolves upstream issue #641 by removing the dependency on
device_entry.original_name(which does not exist onDeviceEntryin Home Assistant's device registry, causing anAttributeError). It refactors the Zigbee2MQTT lock provider to dynamically resolve the MQTT base topic using the device's identifiers, falling back todevice_entry.name.Proposed change
original_nameonDeviceEntryin zigbee2mqtt.py.base_topicin the Zigbee2MQTT provider to parse the friendly name from device identifiers (zigbee2mqtt_<friendly_name>) to robustly support device renaming.device_entry.original_namemocks.test_connect_success_rename_deviceto verify both identifier-based topic resolution and name-based fallbacks.test_connect_missing_state_topicby passing an empty set of identifiers to prevent false matches during connection failure testing.Type of change
Additional information