diff --git a/CHANGELOG.md b/CHANGELOG.md index ca5611621..17ddaacda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog -## Ongoing +## v1.14.8 +- Fix for issue [#933](https://github.com/plugwise/python-plugwise/issues/933) via PR [#934](https://github.com/plugwise/python-plugwise/pull/934) - Declare `packaging` as a dependency; `import plugwise` failed on a clean install without it ## v1.14.7 diff --git a/fixtures/anna_p1/data.json b/fixtures/anna_p1/data.json index b5d92f884..5f4df3f00 100644 --- a/fixtures/anna_p1/data.json +++ b/fixtures/anna_p1/data.json @@ -5,7 +5,7 @@ "off", "Thermostat schedule" ], - "climate_mode": "heat", + "climate_mode": "auto", "control_state": "idle", "dev_class": "thermostat", "firmware": "2018-02-08T11:15:53+01:00", @@ -20,7 +20,7 @@ "vacation", "no_frost" ], - "select_schedule": "off", + "select_schedule": "Thermostat schedule", "sensors": { "illuminance": 2.0, "setpoint": 19.0, diff --git a/plugwise/helper.py b/plugwise/helper.py index 76b213c35..ee361e63b 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -943,18 +943,15 @@ def _rule_ids_by_name(self, name: str, loc_id: str) -> dict[str, dict[str, str]] schedule_ids: dict[str, dict[str, str]] = {} locator = f'./contexts/context/zone/location[@id="{loc_id}"]' for rule in self._domain_objects.findall(f'./rule[name="{name}"]'): - active = rule.find("active").text if rule.find(locator) is not None: schedule_ids[rule.get("id")] = { "location": loc_id, "name": name, - "active": active, } else: schedule_ids[rule.get("id")] = { "location": NONE, "name": name, - "active": active, } return schedule_ids @@ -970,18 +967,15 @@ def _rule_ids_by_tag(self, tag: str, loc_id: str) -> dict[str, dict[str, str]]: for rule in self._domain_objects.findall("./rule"): if rule.find(locator1) is not None: name = rule.find("name").text - active = rule.find("active").text if rule.find(locator2) is not None: schedule_ids[rule.get("id")] = { "location": loc_id, "name": name, - "active": active, } else: schedule_ids[rule.get("id")] = { "location": NONE, "name": name, - "active": active, } return schedule_ids @@ -1001,7 +995,6 @@ def _schedules(self, location: str) -> tuple[list[str], str]: schedules: list[str] = [] for rule_id, data in rule_ids.items(): - active = data["active"] == "true" name = data["name"] locator = f'./rule[@id="{rule_id}"]/directives' # Show an empty schedule as no schedule found @@ -1009,7 +1002,7 @@ def _schedules(self, location: str) -> tuple[list[str], str]: continue # pragma: no cover available.append(name) - if location == data["location"] and active: + if location == data["location"]: selected = name schedules.append(name) diff --git a/pyproject.toml b/pyproject.toml index 02bd410b7..431dc6ce0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "1.14.7" +version = "1.14.8" license = "MIT" description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md" diff --git a/tests/data/anna/anna_p1.json b/tests/data/anna/anna_p1.json index cacbc7e46..b146f8a07 100644 --- a/tests/data/anna/anna_p1.json +++ b/tests/data/anna/anna_p1.json @@ -5,7 +5,7 @@ "off", "Thermostat schedule" ], - "climate_mode": "heat", + "climate_mode": "auto", "control_state": "idle", "dev_class": "thermostat", "firmware": "2018-02-08T11:15:53+01:00", @@ -20,7 +20,7 @@ "vacation", "no_frost" ], - "select_schedule": "off", + "select_schedule": "Thermostat schedule", "sensors": { "illuminance": 2.0, "setpoint": 19.0,