diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml
index 3cb21ec73..edc10bb31 100644
--- a/.github/workflows/verify.yml
+++ b/.github/workflows/verify.yml
@@ -102,7 +102,7 @@ jobs:
if: failure()
run: |
. venv/bin/activate
- ruff --fix plugwise/*py tests/*py
+ ruff check --fix plugwise/*py tests/*py
git config --global user.name 'autoruff'
git config --global user.email 'plugwise@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.PAT_CT }}@github.com/$GITHUB_REPOSITORY
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 89ddfe092..533862cb9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
## Ongoing
+- Combine set_temperature_offset() with set_number()
- Fix typo in manual_fixtures.py script
## v0.37.3
diff --git a/plugwise/__init__.py b/plugwise/__init__.py
index 2f209ceed..cc886c27d 100644
--- a/plugwise/__init__.py
+++ b/plugwise/__init__.py
@@ -323,13 +323,14 @@ async def set_temperature(self, loc_id: str, items: dict[str, float]) -> None:
"""Set the given Temperature on the relevant Thermostat."""
await self._smile_api.set_temperature(loc_id, items)
- async def set_number_setpoint(self, key: str, _: str, temperature: float) -> None:
+ async def set_number(
+ self,
+ key: str,
+ temperature: float,
+ dev_id: str | None = None,
+ ) -> None:
"""Set the max. Boiler or DHW setpoint on the Central Heating boiler."""
- await self._smile_api.set_number_setpoint(key, temperature)
-
- async def set_temperature_offset(self, _: str, dev_id: str, offset: float) -> None:
- """Set the Temperature offset for thermostats that support this feature."""
- await self._smile_api.set_temperature_offset(dev_id, offset)
+ await self._smile_api.set_number(key, temperature, dev_id)
async def set_switch_state(
self, appl_id: str, members: list[str] | None, model: str, state: str
diff --git a/plugwise/legacy/smile.py b/plugwise/legacy/smile.py
index 42c35ad5a..d3277ed04 100644
--- a/plugwise/legacy/smile.py
+++ b/plugwise/legacy/smile.py
@@ -154,7 +154,12 @@ async def set_dhw_mode(self, mode: str) -> None:
async def set_gateway_mode(self, mode: str) -> None:
"""Set-function placeholder for legacy devices."""
- async def set_number_setpoint(self, key: str, temperature: float) -> None:
+ async def set_number(
+ self,
+ key: str,
+ temperature: float,
+ dev_id: str | None,
+ ) -> None:
"""Set-function placeholder for legacy devices."""
async def set_preset(self, _: str, preset: str) -> None:
@@ -268,6 +273,3 @@ async def set_temperature(self, _: str, items: dict[str, float]) -> None:
)
await self._request(uri, method="put", data=data)
-
- async def set_temperature_offset(self, dev_id: str, offset: float) -> None:
- """Set-function placeholder for legacy devices."""
diff --git a/plugwise/smile.py b/plugwise/smile.py
index eb913fb5a..6437ba47e 100644
--- a/plugwise/smile.py
+++ b/plugwise/smile.py
@@ -182,8 +182,17 @@ async def set_gateway_mode(self, mode: str) -> None:
await self._request(uri, method="put", data=data)
- async def set_number_setpoint(self, key: str, temperature: float) -> None:
- """Set the max. Boiler or DHW setpoint on the Central Heating boiler."""
+ async def set_number(
+ self,
+ key: str,
+ temperature: float,
+ dev_id: str | None,
+ ) -> None:
+ """Set the maximum boiler- or DHW-setpoint on the Central Heating boiler or the temperature-offset on a Thermostat."""
+ if dev_id is not None:
+ await self.set_offset(dev_id, temperature)
+ return
+
temp = str(temperature)
thermostat_id: str | None = None
locator = f'appliance[@id="{self._heater_id}"]/actuator_functionalities/thermostat_functionality'
@@ -199,6 +208,19 @@ async def set_number_setpoint(self, key: str, temperature: float) -> None:
data = f"{temp}"
await self._request(uri, method="put", data=data)
+ async def set_offset(self, dev_id: str, offset: float) -> None:
+ """Set the Temperature offset for thermostats that support this feature."""
+ if dev_id not in self.therms_with_offset_func:
+ raise PlugwiseError(
+ "Plugwise: this device does not have temperature-offset capability."
+ )
+
+ value = str(offset)
+ uri = f"{APPLIANCES};id={dev_id}/offset;type=temperature_offset"
+ data = f"{value}"
+
+ await self._request(uri, method="put", data=data)
+
async def set_preset(self, loc_id: str, preset: str) -> None:
"""Set the given Preset on the relevant Thermostat - from LOCATIONS."""
if (presets := self._presets(loc_id)) is None:
@@ -410,16 +432,3 @@ async def set_temperature(self, loc_id: str, items: dict[str, float]) -> None:
)
await self._request(uri, method="put", data=data)
-
- async def set_temperature_offset(self, dev_id: str, offset: float) -> None:
- """Set the Temperature offset for thermostats that support this feature."""
- if dev_id not in self.therms_with_offset_func:
- raise PlugwiseError(
- "Plugwise: this device does not have temperature-offset capability."
- )
-
- value = str(offset)
- uri = f"{APPLIANCES};id={dev_id}/offset;type=temperature_offset"
- data = f"{value}"
-
- await self._request(uri, method="put", data=data)
diff --git a/scripts/tests_and_coverage.sh b/scripts/tests_and_coverage.sh
index 135b8bc49..3b9eca688 100755
--- a/scripts/tests_and_coverage.sh
+++ b/scripts/tests_and_coverage.sh
@@ -36,7 +36,7 @@ fi
if [ -z "${GITHUB_ACTIONS}" ] || [ "$1" == "linting" ] ; then
# Black first to ensure nothings roughing up ruff
echo "... ruff-ing ..."
- ruff plugwise/ tests/
+ ruff check plugwise/ tests/
echo "... pylint-ing ..."
pylint plugwise/ tests/
diff --git a/tests/test_init.py b/tests/test_init.py
index a7c7d8f14..94e489248 100644
--- a/tests/test_init.py
+++ b/tests/test_init.py
@@ -873,11 +873,10 @@ async def tinker_regulation_mode(smile):
async def tinker_max_boiler_temp(smile):
"""Change max boiler temp setpoint to test functionality."""
new_temp = 60.0
- dev_id = None
_LOGGER.info("- Adjusting temperature to %s", new_temp)
for test in ["maximum_boiler_temperature", "bogus_temperature"]:
try:
- await smile.set_number_setpoint(test, dev_id, new_temp)
+ await smile.set_number(test, new_temp)
_LOGGER.info(" + tinker_max_boiler_temp worked as intended")
except pw_exceptions.PlugwiseError:
_LOGGER.info(" + tinker_max_boiler_temp failed as intended")
@@ -888,7 +887,7 @@ async def tinker_temp_offset(smile, dev_id):
new_offset = 1.0
_LOGGER.info("- Adjusting temperature offset to %s", new_offset)
try:
- await smile.set_temperature_offset("dummy", dev_id, new_offset)
+ await smile.set_number("dummy", new_offset, dev_id=dev_id)
_LOGGER.info(" + tinker_temp_offset worked as intended")
return True
except pw_exceptions.PlugwiseError: