Skip to content

Add method to set target temperature for BLU TRV #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions aioshelly/rpc_device/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,17 @@ async def trigger_blu_trv_calibration(self, trv_id: int) -> None:
}
await self.call_rpc("BluTRV.Call", params=params, timeout=BLU_TRV_TIMEOUT)

async def blu_trv_set_target_temperature(
self, trv_id: int, temperature: float
) -> None:
"""Set the target temperatire for BLU TRV."""
params = {
"id": trv_id,
"method": "Trv.SetTarget",
"params": {"id": 0, "target_C": temperature},
}
await self.call_rpc("BluTRV.Call", params=params, timeout=BLU_TRV_TIMEOUT)

async def blu_trv_set_external_temperature(
self, trv_id: int, temperature: float
) -> None:
Expand Down
18 changes: 18 additions & 0 deletions tests/rpc_device/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,24 @@ async def test_trigger_blu_trv_calibration(
assert call_args_list[0][0][1] == 60


@pytest.mark.asyncio
async def test_blu_trv_set_target_temperature(
rpc_device: RpcDevice,
) -> None:
"""Test RpcDevice blu_trv_set_target_temperature() method."""
await rpc_device.blu_trv_set_target_temperature(200, 21.5)

assert rpc_device.call_rpc_multiple.call_count == 1
call_args_list = rpc_device.call_rpc_multiple.call_args_list
assert call_args_list[0][0][0][0][0] == "BluTRV.Call"
assert call_args_list[0][0][0][0][1] == {
"id": 200,
"method": "Trv.SetTarget",
"params": {"id": 0, "target_C": 21.5},
}
assert call_args_list[0][0][1] == 60


@pytest.mark.asyncio
async def test_blu_trv_set_external_temperature(
rpc_device: RpcDevice,
Expand Down