Skip to content

Commit 3c8425e

Browse files
committed
Add 3rd input to the HA-related set-number functions,
to match with the changes in the PW-beta code
1 parent 1037d63 commit 3c8425e

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

plugwise/__init__.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,9 @@ async def set_temperature(self, loc_id: str, items: dict[str, float]) -> None:
711711

712712
await self._request(uri, method="put", data=data)
713713

714-
async def set_number_setpoint(self, key: str, temperature: float) -> None:
714+
async def set_number_setpoint(
715+
self, key: str, dummy: str, temperature: float
716+
) -> None:
715717
"""Set the max. Boiler or DHW setpoint on the Central Heating boiler."""
716718
temp = str(temperature)
717719
thermostat_id: str | None = None
@@ -728,6 +730,16 @@ async def set_number_setpoint(self, key: str, temperature: float) -> None:
728730
data = f"<thermostat_functionality><setpoint>{temp}</setpoint></thermostat_functionality>"
729731
await self._request(uri, method="put", data=data)
730732

733+
async def set_temperature_offset(
734+
self, dummy: str, dev_id: str, offset: float
735+
) -> None:
736+
"""Set the Temperature offset for thermostats that support this feature."""
737+
value = str(offset)
738+
uri = f"{APPLIANCES};id={dev_id}/offset;type=temperature_offset"
739+
data = f"<offset_functionality><offset>{value}</offset></offset_functionality>"
740+
741+
await self._request(uri, method="put", data=data)
742+
731743
async def _set_groupswitch_member_state(
732744
self, members: list[str], state: str, switch: Munch
733745
) -> None:
@@ -823,14 +835,6 @@ async def set_dhw_mode(self, mode: str) -> None:
823835

824836
await self._request(uri, method="put", data=data)
825837

826-
async def set_temperature_offset(self, dev_id: str, offset: float) -> None:
827-
"""Set the temperature offset for thermostats that support this feature."""
828-
829-
uri = f"{APPLIANCES};id={dev_id}/offset;type=temperature_offset"
830-
data = f"<offset_functionality><offset>{offset}</offset></offset_functionality>"
831-
832-
await self._request(uri, method="put", data=data)
833-
834838
async def delete_notification(self) -> None:
835839
"""Delete the active Plugwise Notification."""
836840
await self._request(NOTIFICATIONS, method="delete")

tests/test_smile.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,10 +647,11 @@ async def tinker_regulation_mode(smile):
647647
async def tinker_max_boiler_temp(smile):
648648
"""Change max boiler temp setpoint to test functionality."""
649649
new_temp = 60.0
650+
dev_id = None
650651
_LOGGER.info("- Adjusting temperature to %s", new_temp)
651652
for test in ["maximum_boiler_temperature", "bogus_temperature"]:
652653
try:
653-
await smile.set_number_setpoint(test, new_temp)
654+
await smile.set_number_setpoint(test, dev_id, new_temp)
654655
_LOGGER.info(" + worked as intended")
655656
except pw_exceptions.PlugwiseError:
656657
_LOGGER.info(" + failed as intended")

0 commit comments

Comments
 (0)