Skip to content

Commit 7dfa0db

Browse files
committed
Fix lock update
1 parent 7095e1c commit 7dfa0db

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

custom_components/sector/lock.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ async def async_setup_entry(
3434
return
3535

3636
locks = await sector_hub.get_locks()
37+
if not locks:
38+
return
3739
lockdevices: list = []
3840
for lock in locks:
3941
name = await sector_hub.get_name(lock, "lock")
@@ -122,6 +124,6 @@ async def async_lock(self, **kwargs) -> None:
122124
def _handle_coordinator_update(self) -> None:
123125
"""Handle updated data from the coordinator."""
124126
self._attr_is_locked = bool(
125-
self._hub.lock_state[self.entity_description.key] == STATE_LOCKED
127+
self._hub.lock_state[self.entity_description.key] == "lock"
126128
)
127129
self.async_write_ha_state()

custom_components/sector/switch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ async def async_setup_entry(
3232
]
3333

3434
switches = await sector_hub.get_switches()
35+
if not switches:
36+
return
3537
switchlist: list = []
3638
for switch in switches:
3739
name = await sector_hub.get_name(switch, "switch")

0 commit comments

Comments
 (0)