From 6bdee67e50103a45ca8211d1ddb6c4ec71f16d85 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 21 May 2024 08:14:18 +0200 Subject: [PATCH 01/10] Correct args-order for set_schedule+state() --- plugwise/legacy/smile.py | 6 +++--- plugwise/smile.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugwise/legacy/smile.py b/plugwise/legacy/smile.py index 6bb8f6854..03d4e5160 100644 --- a/plugwise/legacy/smile.py +++ b/plugwise/legacy/smile.py @@ -184,9 +184,9 @@ async def set_regulation_mode(self, mode: str) -> None: async def set_select(self, key: str, loc_id: str, option: str, name: 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 state corresponds to select name + # schedule name corresponds to select option + await self.set_schedule_state("dummy", name, option) async def set_schedule_state(self, _: str, state: str, name: str | None) -> None: """Activate/deactivate the Schedule. diff --git a/plugwise/smile.py b/plugwise/smile.py index e26d90ab7..1aa587966 100644 --- a/plugwise/smile.py +++ b/plugwise/smile.py @@ -218,9 +218,9 @@ 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 state corresponds to select name + # schedule name corresponds to select option + await self.set_schedule_state(loc_id, name, option) async def set_dhw_mode(self, mode: str) -> None: """Set the domestic hot water heating regulation mode.""" From 79c15eddec45b8629f0c06fdd24414b28cc43a9d Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 21 May 2024 08:15:31 +0200 Subject: [PATCH 02/10] Adapt related test --- tests/test_init.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_init.py b/tests/test_init.py index 45fc05469..59343a296 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -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: From 9214b39b250814e09703dd71038c56bb96009d43 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 21 May 2024 08:16:55 +0200 Subject: [PATCH 03/10] Fix 2nd test --- tests/test_init.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_init.py b/tests/test_init.py index 59343a296..d477f7765 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -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: From edfb5a94cbefee075b9f0d6b0a6bb9cecce5577e Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 21 May 2024 18:17:28 +0200 Subject: [PATCH 04/10] Change var-name --- plugwise/__init__.py | 8 ++++---- plugwise/legacy/smile.py | 6 +++--- plugwise/smile.py | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugwise/__init__.py b/plugwise/__init__.py index 245aadae1..ce2a5981f 100644 --- a/plugwise/__init__.py +++ b/plugwise/__init__.py @@ -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, 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.""" diff --git a/plugwise/legacy/smile.py b/plugwise/legacy/smile.py index 03d4e5160..586d414a1 100644 --- a/plugwise/legacy/smile.py +++ b/plugwise/legacy/smile.py @@ -182,11 +182,11 @@ 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 name + # schedule state corresponds to select state # schedule name corresponds to select option - await self.set_schedule_state("dummy", name, option) + await self.set_schedule_state("dummy", state, option) async def set_schedule_state(self, _: str, state: str, name: str | None) -> None: """Activate/deactivate the Schedule. diff --git a/plugwise/smile.py b/plugwise/smile.py index 1aa587966..dc1bd18fb 100644 --- a/plugwise/smile.py +++ b/plugwise/smile.py @@ -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": @@ -220,7 +220,7 @@ async def set_select(self, key: str, loc_id: str, option: str, name: str | None) case "select_schedule": # schedule state corresponds to select name # schedule name corresponds to select option - await self.set_schedule_state(loc_id, name, 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.""" From e45c5fd52b11fab9d1bc1af405f79e1902ddb4fb Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 21 May 2024 18:18:40 +0200 Subject: [PATCH 05/10] Bump to v0.37.9a0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 295d235b9..35ce0283b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "0.37.8" +version = "0.37.9a0" license = {file = "LICENSE"} description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md" From 1867b82312e210df38e1de1cbc888bb20188afdf Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 21 May 2024 19:11:33 +0200 Subject: [PATCH 06/10] Fix typing --- plugwise/__init__.py | 2 +- plugwise/legacy/smile.py | 2 +- plugwise/smile.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugwise/__init__.py b/plugwise/__init__.py index ce2a5981f..73d2240a1 100644 --- a/plugwise/__init__.py +++ b/plugwise/__init__.py @@ -319,7 +319,7 @@ async def set_select( async def set_schedule_state( self, loc_id: str, - state: str, + state: str | None, name: str | None = None, ) -> None: """Activate/deactivate the Schedule, with the given name, on the relevant Thermostat.""" diff --git a/plugwise/legacy/smile.py b/plugwise/legacy/smile.py index 586d414a1..14488d502 100644 --- a/plugwise/legacy/smile.py +++ b/plugwise/legacy/smile.py @@ -188,7 +188,7 @@ async def set_select(self, key: str, loc_id: str, option: str, state: str | None # 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. diff --git a/plugwise/smile.py b/plugwise/smile.py index dc1bd18fb..0aceaac81 100644 --- a/plugwise/smile.py +++ b/plugwise/smile.py @@ -271,7 +271,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. From fb0d85c25198803da00a5aaf64888161beef21e4 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 21 May 2024 19:13:23 +0200 Subject: [PATCH 07/10] Clean up comments --- plugwise/legacy/smile.py | 1 - plugwise/smile.py | 1 - 2 files changed, 2 deletions(-) diff --git a/plugwise/legacy/smile.py b/plugwise/legacy/smile.py index 14488d502..5123d7bce 100644 --- a/plugwise/legacy/smile.py +++ b/plugwise/legacy/smile.py @@ -184,7 +184,6 @@ async def set_regulation_mode(self, mode: str) -> 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 state # schedule name corresponds to select option await self.set_schedule_state("dummy", state, option) diff --git a/plugwise/smile.py b/plugwise/smile.py index 0aceaac81..fde482ee5 100644 --- a/plugwise/smile.py +++ b/plugwise/smile.py @@ -218,7 +218,6 @@ async def set_select(self, key: str, loc_id: str, option: str, state: str | None case "select_regulation_mode": await self.set_regulation_mode(option) case "select_schedule": - # schedule state corresponds to select name # schedule name corresponds to select option await self.set_schedule_state(loc_id, state, option) From 97c7f1913b72896dc3c4ac0af003832cc9984d17 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 21 May 2024 19:17:30 +0200 Subject: [PATCH 08/10] Bump to a1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 35ce0283b..90fac9b10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "0.37.9a0" +version = "0.37.9a1" license = {file = "LICENSE"} description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md" From 1e420abd8fd4514da262acab6b154d2f7a62f0c4 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 21 May 2024 19:33:02 +0200 Subject: [PATCH 09/10] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3cbe5d53..c35e25049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. From 283072c5b6b00ebe723cffac6b7e1993fadb88ec Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 21 May 2024 19:33:33 +0200 Subject: [PATCH 10/10] Bump to v0.37.9 release-version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 90fac9b10..77157b9a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "0.37.9a1" +version = "0.37.9" license = {file = "LICENSE"} description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md"