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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions fixtures/anna_p1/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -20,7 +20,7 @@
"vacation",
"no_frost"
],
"select_schedule": "off",
"select_schedule": "Thermostat schedule",
"sensors": {
"illuminance": 2.0,
"setpoint": 19.0,
Expand Down
9 changes: 1 addition & 8 deletions plugwise/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -1001,15 +995,14 @@ 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
if self._domain_objects.find(locator) is None:
continue # pragma: no cover

available.append(name)
if location == data["location"] and active:
if location == data["location"]:
selected = name
schedules.append(name)

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 = "1.14.7"
version = "1.14.8"
license = "MIT"
description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3."
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions tests/data/anna/anna_p1.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -20,7 +20,7 @@
"vacation",
"no_frost"
],
"select_schedule": "off",
"select_schedule": "Thermostat schedule",
"sensors": {
"illuminance": 2.0,
"setpoint": 19.0,
Expand Down
Loading