diff --git a/CHANGELOG.md b/CHANGELOG.md index 49cf56928..bae92bd0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.14.3-1 + +- Correct typing of select_schedule, manual fixture update + ## v1.14.3 - Change representation of no-thermostat-schedule-defined to a single `off` option via PR [#899](https://github.com/plugwise/python-plugwise/pull/899) diff --git a/fixtures/m_adam_multiple_devices_per_zone/data.json b/fixtures/m_adam_multiple_devices_per_zone/data.json index b1529e121..6b05f6bc0 100644 --- a/fixtures/m_adam_multiple_devices_per_zone/data.json +++ b/fixtures/m_adam_multiple_devices_per_zone/data.json @@ -128,7 +128,9 @@ }, "446ac08dd04d4eff8ac57489757b7314": { "active_preset": "no_frost", - "available_schedules": [], + "available_schedules": [ + "off" + ], "climate_mode": "heat", "control_state": "idle", "dev_class": "climate", @@ -141,7 +143,7 @@ "vacation", "no_frost" ], - "select_schedule": null, + "select_schedule": "off", "sensors": { "temperature": 15.6 }, diff --git a/plugwise/__init__.py b/plugwise/__init__.py index f91308726..2165322c3 100644 --- a/plugwise/__init__.py +++ b/plugwise/__init__.py @@ -60,8 +60,8 @@ def __init__( password, port, self._timeout, - username, - websession, + username=username, + websession=websession, ) self._cooling_present = False diff --git a/plugwise/constants.py b/plugwise/constants.py index 327862ae3..a35ea6042 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -584,7 +584,7 @@ class GwEntityData(TypedDict, total=False): preset_modes: list[str] | None # Schedules: available_schedules: list[str] - select_schedule: str | None + select_schedule: str climate_mode: str # Extra for Adam Master Thermostats diff --git a/plugwise/smilecomm.py b/plugwise/smilecomm.py index 7d3425587..e770ec7d2 100644 --- a/plugwise/smilecomm.py +++ b/plugwise/smilecomm.py @@ -34,6 +34,7 @@ def __init__( password: str, port: int, timeout: int, + *, username: str, websession: ClientSession | None, ) -> None: diff --git a/pyproject.toml b/pyproject.toml index 4b8b585c5..c072e3c88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "1.14.3" +version = "1.14.3-1" license = "MIT" description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md" diff --git a/scripts/manual_fixtures.py b/scripts/manual_fixtures.py index fd25e76df..7e51caa69 100755 --- a/scripts/manual_fixtures.py +++ b/scripts/manual_fixtures.py @@ -38,10 +38,10 @@ def json_writer(manual_name: str, output: dict) -> None: # Change schedule to not present for "446ac08dd04d4eff8ac57489757b7314" adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"][ "available_schedules" -] = [] +] = ["off"] adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"][ "select_schedule" -] = None +] = "off" json_writer("m_adam_multiple_devices_per_zone", adam_multiple_devices_per_zone) diff --git a/tests/test_init.py b/tests/test_init.py index bcf09f765..938444051 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -283,6 +283,7 @@ async def connect( broken=False, fail_auth=False, raise_timeout=False, + *, smile_timeout_value=10, stretch=False, timeout_happened=False, @@ -728,7 +729,7 @@ async def tinker_thermostat_preset(self, api, loc_id, unhappy=False): @pytest.mark.asyncio async def tinker_thermostat_schedule( - self, api, loc_id, state, good_schedules=None, single=False, unhappy=False + self, api, loc_id, state, *, good_schedules=None, single=False, unhappy=False ): """Toggle schedules to test functionality.""" # pragma warning disable S3776 @@ -798,6 +799,7 @@ async def tinker_thermostat( self, api, loc_id, + *, schedule_on=True, good_schedules=None, single=False, @@ -817,14 +819,29 @@ async def tinker_thermostat( for item in api._schedule_old_states[loc_id]: api._schedule_old_states[loc_id][item] = "off" result_3 = await self.tinker_thermostat_schedule( - api, loc_id, "on", good_schedules, single, unhappy + api, + loc_id, + "on", + good_schedules=good_schedules, + single=single, + unhappy=unhappy, ) if schedule_on: result_4 = await self.tinker_thermostat_schedule( - api, loc_id, "off", good_schedules, single, unhappy + api, + loc_id, + "off", + good_schedules=good_schedules, + single=single, + unhappy=unhappy, ) result_5 = await self.tinker_thermostat_schedule( - api, loc_id, "on", good_schedules, single, unhappy + api, + loc_id, + "on", + good_schedules=good_schedules, + single=single, + unhappy=unhappy, ) return result_1 and result_2 and result_3 and result_4 and result_5 return result_1 and result_2 and result_3