Skip to content

Commit 4968d31

Browse files
committed
Handle no lock-attribute present
1 parent 6e61512 commit 4968d31

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugwise/smile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ async def set_switch_state(
380380
self, appl_id: str, members: list[str] | None, model: str, state: str
381381
) -> bool:
382382
"""Set the given State of the relevant Switch."""
383-
current_state = self.gw_entities[appl_id]["switches"]["relay"]
383+
current_state = self.gw_entities[appl_id]["switches"][model]
384384
requested_state = state == STATE_ON
385385
switch = Munch()
386386
switch.actuator = "actuator_functionalities"
@@ -425,7 +425,8 @@ async def set_switch_state(
425425

426426
uri = f"{APPLIANCES};id={appl_id}/{switch.device};id={switch_id}"
427427
if model == "relay" and self.gw_entities[appl_id]["switches"].get("lock"):
428-
# Don't switch a relay when its corresponding lock-state is true
428+
# Don't switch a relay when its corresponding lock-state is true or no
429+
# lock is present. That means the relay can't be controlled by the user.
429430
return current_state
430431

431432
await self.call_request(uri, method="put", data=data)

0 commit comments

Comments
 (0)