Skip to content
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.37.9

- Correct set_select() function.

## v0.37.8

- Create a set_select() function, combining the set_dhw_mode(), set_gateway_mode(), set_regulation_mode() and set_schedule_state() functions.
Expand Down
8 changes: 4 additions & 4 deletions plugwise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,19 +311,19 @@ async def set_select(
key: str,
loc_id: str,
option: str,
name: str | None = None,
state: str | None = None,
) -> None:
"""Set the selected option for the applicable Select."""
await self._smile_api.set_select(key, loc_id, option, name)
await self._smile_api.set_select(key, loc_id, option, state)

async def set_schedule_state(
self,
loc_id: str,
new_state: str,
state: str | None,
name: str | None = None,
) -> None:
"""Activate/deactivate the Schedule, with the given name, on the relevant Thermostat."""
await self._smile_api.set_schedule_state(loc_id, new_state, name)
await self._smile_api.set_schedule_state(loc_id, state, name)

async def set_preset(self, loc_id: str, preset: str) -> None:
"""Set the given Preset on the relevant Thermostat."""
Expand Down
9 changes: 4 additions & 5 deletions plugwise/legacy/smile.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,12 @@ async def set_preset(self, _: str, preset: str) -> None:
async def set_regulation_mode(self, mode: str) -> None:
"""Set-function placeholder for legacy devices."""

async def set_select(self, key: str, loc_id: str, option: str, name: str | None) -> None:
async def set_select(self, key: str, loc_id: str, option: str, state: str | None) -> None:
"""Set the thermostat schedule option."""
# schedule state corresponds to select option
# schedule name corresponds to select name
await self.set_schedule_state("dummy", option, name)
# schedule name corresponds to select option
await self.set_schedule_state("dummy", state, option)

async def set_schedule_state(self, _: str, state: str, name: str | None) -> None:
async def set_schedule_state(self, _: str, state: str | None, name: str | None) -> None:
"""Activate/deactivate the Schedule.

Determined from - DOMAIN_OBJECTS.
Expand Down
9 changes: 4 additions & 5 deletions plugwise/smile.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ async def set_preset(self, loc_id: str, preset: str) -> None:

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

async def set_select(self, key: str, loc_id: str, option: str, name: str | None) -> None:
async def set_select(self, key: str, loc_id: str, option: str, state: str | None) -> None:
"""Set a dhw/gateway/regulation mode or the thermostat schedule option."""
match key:
case "select_dhw_mode":
Expand All @@ -218,9 +218,8 @@ async def set_select(self, key: str, loc_id: str, option: str, name: str | None)
case "select_regulation_mode":
await self.set_regulation_mode(option)
case "select_schedule":
# schedule state corresponds to select option
# schedule name corresponds to select name
await self.set_schedule_state(loc_id, option, name)
# schedule name corresponds to select option
await self.set_schedule_state(loc_id, state, option)

async def set_dhw_mode(self, mode: str) -> None:
"""Set the domestic hot water heating regulation mode."""
Expand Down Expand Up @@ -271,7 +270,7 @@ async def set_regulation_mode(self, mode: str) -> None:
async def set_schedule_state(
self,
loc_id: str,
new_state: str,
new_state: str | None,
name: str | None,
) -> None:
"""Activate/deactivate the Schedule, with the given name, on the relevant Thermostat.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "plugwise"
version = "0.37.8"
version = "0.37.9"
license = {file = "LICENSE"}
description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3."
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ async def tinker_thermostat_schedule(
new_schedule = new_schedule[1:]
_LOGGER.info("- Adjusting schedule to %s", f"{new_schedule}{warning}")
try:
await smile.set_select("select_schedule", loc_id, state, new_schedule)
await smile.set_select("select_schedule", loc_id, new_schedule, state)
tinker_schedule_passed = True
_LOGGER.info(" + working as intended")
except pw_exceptions.PlugwiseError:
Expand Down Expand Up @@ -763,7 +763,7 @@ async def tinker_legacy_thermostat_schedule(self, smile, unhappy=False):
for state in states:
_LOGGER.info("- Adjusting schedule to state %s", state)
try:
await smile.set_select("select_schedule", "dummy", state)
await smile.set_select("select_schedule", "dummy", None, state)
tinker_schedule_passed = True
_LOGGER.info(" + working as intended")
except pw_exceptions.PlugwiseError:
Expand Down