Skip to content

Commit 11e81ae

Browse files
authored
Merge pull request #547 from plugwise/fix-set-temp-legacy
Fix for Plugwise-beta Issue #620
2 parents fd96cfe + b7ddaec commit 11e81ae

File tree

4 files changed

+20
-28
lines changed

4 files changed

+20
-28
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v0.37.3
4+
5+
- Fix for [plugwise-beta #620](https://github.com/plugwise/plugwise-beta/issues/620)
6+
37
## v0.37.2
48

59
- Code improvements

plugwise/legacy/smile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,12 @@ async def _set_groupswitch_member_state(
249249

250250
await self._request(uri, method="put", data=data)
251251

252-
async def set_temperature(self, setpoint: str, _: dict[str, float]) -> None:
252+
async def set_temperature(self, _: str, items: dict[str, float]) -> None:
253253
"""Set the given Temperature on the relevant Thermostat."""
254+
setpoint: float | None = None
255+
if "setpoint" in items:
256+
setpoint = items["setpoint"]
257+
254258
if setpoint is None:
255259
raise PlugwiseError(
256260
"Plugwise: failed setting temperature: no valid input provided"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "plugwise"
7-
version = "0.37.2"
7+
version = "0.37.3"
88
license = {file = "LICENSE"}
99
description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3."
1010
readme = "README.md"

tests/test_init.py

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -686,30 +686,6 @@ async def tinker_thermostat_temp(
686686

687687
return tinker_temp_passed
688688

689-
@pytest.mark.asyncio
690-
async def tinker_legacy_thermostat_temp(self, smile, unhappy=False):
691-
"""Toggle temperature to test functionality."""
692-
_LOGGER.info("Assert modifying temperature setpoint")
693-
tinker_temp_passed = False
694-
test_temp = 22.9
695-
_LOGGER.info("- Adjusting temperature to %s", test_temp)
696-
try:
697-
await smile.set_temperature(test_temp, None)
698-
_LOGGER.info(" + worked as intended")
699-
tinker_temp_passed = True
700-
except (
701-
pw_exceptions.ErrorSendingCommandError,
702-
pw_exceptions.ResponseError,
703-
):
704-
if unhappy:
705-
_LOGGER.info(" + failed as expected")
706-
tinker_temp_passed = True
707-
else: # pragma: no cover
708-
_LOGGER.info(" - failed unexpectedly")
709-
tinker_temp_passed = False
710-
711-
return tinker_temp_passed
712-
713689
@pytest.mark.asyncio
714690
async def tinker_thermostat_preset(self, smile, loc_id, unhappy=False):
715691
"""Toggle preset to test functionality."""
@@ -843,9 +819,17 @@ async def tinker_thermostat(
843819
return result_1 and result_2 and result_3
844820

845821
@pytest.mark.asyncio
846-
async def tinker_legacy_thermostat(self, smile, schedule_on=True, unhappy=False):
822+
async def tinker_legacy_thermostat(
823+
self,
824+
smile,
825+
schedule_on=True,
826+
block_cooling=False,
827+
unhappy=False
828+
):
847829
"""Toggle various climate settings to test functionality."""
848-
result_1 = await self.tinker_legacy_thermostat_temp(smile, unhappy)
830+
result_1 = await self.tinker_thermostat_temp(
831+
smile, "dummy", block_cooling, unhappy
832+
)
849833
result_2 = await self.tinker_thermostat_preset(smile, None, unhappy)
850834
result_3 = await self.tinker_legacy_thermostat_schedule(smile, unhappy)
851835
if schedule_on:

0 commit comments

Comments
 (0)