Skip to content

Commit

Permalink
Fix lock update
Browse files Browse the repository at this point in the history
  • Loading branch information
gjohansson-ST committed Dec 20, 2021
1 parent 7095e1c commit 7dfa0db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/sector/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ async def async_setup_entry(
return

locks = await sector_hub.get_locks()
if not locks:
return
lockdevices: list = []
for lock in locks:
name = await sector_hub.get_name(lock, "lock")
Expand Down Expand Up @@ -122,6 +124,6 @@ async def async_lock(self, **kwargs) -> None:
def _handle_coordinator_update(self) -> None:
"""Handle updated data from the coordinator."""
self._attr_is_locked = bool(
self._hub.lock_state[self.entity_description.key] == STATE_LOCKED
self._hub.lock_state[self.entity_description.key] == "lock"
)
self.async_write_ha_state()
2 changes: 2 additions & 0 deletions custom_components/sector/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ async def async_setup_entry(
]

switches = await sector_hub.get_switches()
if not switches:
return
switchlist: list = []
for switch in switches:
name = await sector_hub.get_name(switch, "switch")
Expand Down

0 comments on commit 7dfa0db

Please sign in to comment.