From 0e74f9ae84c97429db46a0e011bdf25564e22c0c Mon Sep 17 00:00:00 2001 From: Katie Mulliken Date: Thu, 5 Feb 2026 22:04:48 -0500 Subject: [PATCH 1/2] chore: bump version to 0.1.36 Co-Authored-By: Claude Opus 4.6 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 051e9983..03aef554 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ [project] name = "ha-wyzeapi" -version = "0.1.35" +version = "0.1.36" description = "A Home Assistant integration for Wyze devices" authors = [{ name = "Katie Mulliken", email = "katie@mulliken.net" }] license = { text = "Apache-2.0" } @@ -12,7 +12,7 @@ requires-python = ">=3.13.2,<3.14" dependencies = [ "homeassistant>=2025.5.0", - "wyzeapy>=0.5.30,<0.6.0", + "wyzeapy>=0.5.31,<0.6.0", ] [build-system] From 4e3f1d636209a99cdc317fb32b4e379c46fdc523 Mon Sep 17 00:00:00 2001 From: Katie Mulliken Date: Wed, 4 Mar 2026 23:48:15 -0500 Subject: [PATCH 2/2] fix(lock): prevent KeyError when Lock Bolt coordinator is missing Always initialize the 'coordinators' dict in hass.data at entry setup so the key is guaranteed to exist. In lock.py, use .get() instead of direct dict access and log a warning + skip when a YD_BT1 lock has no coordinator, rather than crashing the entire lock platform. Fixes a race condition where setup_coordinators() could find no YD_BT1 devices (e.g. due to an API hiccup) while the lock platform's own get_locks() call did find one, causing KeyError: 'coordinators'. Closes #778 Co-Authored-By: Claude Sonnet 4.6 --- custom_components/wyzeapi/__init__.py | 1 + custom_components/wyzeapi/lock.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/custom_components/wyzeapi/__init__.py b/custom_components/wyzeapi/__init__.py index 948d7347..da11d3d2 100644 --- a/custom_components/wyzeapi/__init__.py +++ b/custom_components/wyzeapi/__init__.py @@ -137,6 +137,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b CONF_CLIENT: client, "key_id": KEY_ID, "api_key": API_KEY, + "coordinators": {}, } await setup_coordinators(hass, config_entry, client) diff --git a/custom_components/wyzeapi/lock.py b/custom_components/wyzeapi/lock.py index e8318247..afe4b98c 100644 --- a/custom_components/wyzeapi/lock.py +++ b/custom_components/wyzeapi/lock.py @@ -58,11 +58,17 @@ async def async_setup_entry( if lock.product_model != "YD_BT1" ] lock_bolts = [] + coordinators = hass.data[DOMAIN][config_entry.entry_id].get("coordinators", {}) for lock in all_locks: if lock.product_model == "YD_BT1": - coordinator = hass.data[DOMAIN][config_entry.entry_id]["coordinators"][ - lock.mac - ] + coordinator = coordinators.get(lock.mac) + if coordinator is None: + _LOGGER.warning( + "No coordinator found for Lock Bolt %s (%s), skipping", + lock.nickname, + lock.mac, + ) + continue lock_bolts.append(WyzeLockBolt(coordinator)) async_add_entities(locks + lock_bolts, True)