Skip to content

Commit b17428b

Browse files
committed
Use the appropriate method
1 parent dc5fb7a commit b17428b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

plugwise/smile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def model_to_switch_items(model: str, state: str, switch: Munch) -> tuple[str, M
5454
switch.act_type = "cooling_enabled"
5555
case "lock":
5656
switch.func = "lock"
57+
switch.method = "post"
5758
state = "true" if state == STATE_ON else "false"
5859

5960
return state, switch
@@ -446,6 +447,7 @@ async def set_switch_state(
446447
switch.device = "relay"
447448
switch.func_type = "relay_functionality"
448449
switch.func = "state"
450+
switch.method = "put"
449451
state, switch = model_to_switch_items(model, state, switch)
450452
data = (
451453
f"<{switch.func_type}>"
@@ -469,7 +471,7 @@ async def set_switch_state(
469471
# lock is present. That means the relay can't be controlled by the user.
470472
return current_state
471473

472-
await self.call_request(uri, method="put", data=data)
474+
await self.call_request(uri, method=switch.method, data=data)
473475
return requested_state
474476

475477
async def _set_groupswitch_member_state(

0 commit comments

Comments
 (0)