Skip to content

Commit 2c64b0d

Browse files
authored
Merge pull request #893 from plugwise/legacy-max-boiler
Implement boiler_temperature dict for legacy Anna
2 parents d2a92e5 + a53b02a commit 2c64b0d

9 files changed

Lines changed: 77 additions & 54 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v1.13.1
4+
5+
- Implement dedicated boiler_temperature dict for legacy Anna via PR [#893](https://github.com/plugwise/python-plugwise/pull/893)
6+
37
## v1.13.0
48

59
- Improve on v1.12.0 update by outputting dedicated boiler_ and dhw_temperature dicts with current-key added. Rename dhw_mode off to eco for standard cv-heaters.

fixtures/legacy_anna/data.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
"flame_state": true,
1414
"heating_state": true
1515
},
16-
"dev_class": "heater_central",
17-
"location": "0000aaaa0000aaaa0000aaaa0000aa00",
18-
"maximum_boiler_temperature": {
16+
"boiler_temperature": {
17+
"current": 23.6,
1918
"lower_bound": 50.0,
2019
"resolution": 1.0,
2120
"setpoint": 50.0,
2221
"upper_bound": 90.0
2322
},
23+
"dev_class": "heater_central",
24+
"location": "0000aaaa0000aaaa0000aaaa0000aa00",
2425
"model": "Generic heater",
2526
"name": "OpenTherm",
2627
"sensors": {
2728
"dhw_temperature": 51.2,
2829
"intended_boiler_temperature": 17.0,
2930
"modulation_level": 0.0,
3031
"return_temperature": 21.7,
31-
"water_pressure": 1.2,
32-
"water_temperature": 23.6
32+
"water_pressure": 1.2
3333
},
3434
"vendor": "Bosch Thermotechniek B.V."
3535
},

fixtures/legacy_anna_2/data.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,23 @@
5151
"flame_state": false,
5252
"heating_state": false
5353
},
54-
"dev_class": "heater_central",
55-
"location": "be81e3f8275b4129852c4d8d550ae2eb",
56-
"maximum_boiler_temperature": {
54+
"boiler_temperature": {
55+
"current": 54.0,
5756
"lower_bound": 50.0,
5857
"resolution": 1.0,
5958
"setpoint": 70.0,
6059
"upper_bound": 90.0
6160
},
61+
"dev_class": "heater_central",
62+
"location": "be81e3f8275b4129852c4d8d550ae2eb",
6263
"model": "Generic heater",
6364
"name": "OpenTherm",
6465
"sensors": {
6566
"dhw_temperature": 0.0,
6667
"intended_boiler_temperature": 0.0,
6768
"modulation_level": 0.0,
6869
"return_temperature": 0.0,
69-
"water_pressure": 1.7,
70-
"water_temperature": 54.0
70+
"water_pressure": 1.7
7171
}
7272
}
7373
}

plugwise/common.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99

1010
from plugwise.constants import (
1111
ANNA,
12+
DHW_SETPOINT,
1213
GROUP_TYPES,
1314
NONE,
1415
PRIORITY_DEVICE_CLASSES,
1516
SPECIAL_PLUG_TYPES,
1617
SWITCH_GROUP_TYPES,
18+
ActuatorData,
1719
ApplianceType,
1820
GwEntityData,
1921
ModuleData,
@@ -289,3 +291,31 @@ def _get_module_data(
289291
break
290292

291293
return module_data
294+
295+
def _create_special_dicts(
296+
self, item: str, data: GwEntityData, temp_dict: ActuatorData
297+
) -> tuple[str, ActuatorData]:
298+
"""Create dhw_temperature and boiler_temperature dicts.
299+
300+
The initial item-names are updated and a current key is added.
301+
Also, the copied sensor data is removed.
302+
"""
303+
if item == DHW_SETPOINT:
304+
item = "dhw_temperature"
305+
if DHW_SETPOINT in data["sensors"]:
306+
data["sensors"].pop(DHW_SETPOINT)
307+
self._count -= 1
308+
if "dhw_temperature" in data["sensors"]:
309+
temp_dict["current"] = data["sensors"]["dhw_temperature"]
310+
data["sensors"].pop("dhw_temperature")
311+
elif "water_temperature" in data["sensors"]:
312+
temp_dict["current"] = data["sensors"]["water_temperature"]
313+
self._count += 1
314+
315+
if item == "maximum_boiler_temperature":
316+
item = "boiler_temperature"
317+
if "water_temperature" in data["sensors"]:
318+
temp_dict["current"] = data["sensors"]["water_temperature"]
319+
data["sensors"].pop("water_temperature")
320+
321+
return item, temp_dict

plugwise/helper.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
ATTR_NAME,
1919
DATA,
2020
DEVICE_MEASUREMENTS,
21-
DHW_SETPOINT,
2221
DOMAIN_OBJECTS,
2322
ENERGY_WATT_HOUR,
2423
GROUP_MEASUREMENTS,
@@ -587,34 +586,6 @@ def _get_actuator_functionalities(
587586
act_item = cast(ActuatorType, item)
588587
data[act_item] = temp_dict
589588

590-
def _create_special_dicts(
591-
self, item: str, data: GwEntityData, temp_dict: ActuatorData
592-
) -> tuple[str, ActuatorData]:
593-
"""Create dhw_temperature and boiler_temperature dicts.
594-
595-
The initial item-names are updated and a current key is added.
596-
Also, the copied sensor data is removed.
597-
"""
598-
if item == DHW_SETPOINT:
599-
item = "dhw_temperature"
600-
if DHW_SETPOINT in data["sensors"]:
601-
data["sensors"].pop(DHW_SETPOINT)
602-
self._count -= 1
603-
if "dhw_temperature" in data["sensors"]:
604-
temp_dict["current"] = data["sensors"]["dhw_temperature"]
605-
data["sensors"].pop("dhw_temperature")
606-
elif "water_temperature" in data["sensors"]:
607-
temp_dict["current"] = data["sensors"]["water_temperature"]
608-
self._count += 1
609-
610-
if item == "maximum_boiler_temperature":
611-
item = "boiler_temperature"
612-
if "water_temperature" in data["sensors"]:
613-
temp_dict["current"] = data["sensors"]["water_temperature"]
614-
data["sensors"].pop("water_temperature")
615-
616-
return item, temp_dict
617-
618589
def _get_actuator_mode(
619590
self, appliance: etree.Element, entity_id: str, key: str
620591
) -> str | None:

plugwise/legacy/helper.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ def _appliance_measurements(
341341

342342
self._count = count_data_items(self._count, data)
343343

344-
def _get_actuator_functionalities(self, xml: etree.Element, data: GwEntityData) -> None:
344+
def _get_actuator_functionalities(
345+
self, xml: etree.Element, data: GwEntityData
346+
) -> None:
345347
"""Helper-function for _get_measurement_data()."""
346348
for item in ACTIVE_ACTUATORS:
347349
temp_dict: ActuatorData = {}
@@ -364,6 +366,7 @@ def _get_actuator_functionalities(self, xml: etree.Element, data: GwEntityData)
364366
self._count += 1
365367

366368
if temp_dict:
369+
item, temp_dict = self._create_special_dicts(item, data, temp_dict)
367370
act_item = cast(ActuatorType, item)
368371
data[act_item] = temp_dict
369372

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "plugwise"
7-
version = "1.13.0"
7+
version = "1.13.1"
88
license = "MIT"
99
description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3."
1010
readme = "README.md"

tests/data/anna/legacy_anna.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
"flame_state": true,
1414
"heating_state": true
1515
},
16-
"dev_class": "heater_central",
17-
"location": "0000aaaa0000aaaa0000aaaa0000aa00",
18-
"maximum_boiler_temperature": {
16+
"boiler_temperature": {
17+
"current": 23.6,
1918
"lower_bound": 50.0,
2019
"resolution": 1.0,
2120
"setpoint": 50.0,
2221
"upper_bound": 90.0
2322
},
23+
"dev_class": "heater_central",
24+
"location": "0000aaaa0000aaaa0000aaaa0000aa00",
2425
"model": "Generic heater",
2526
"name": "OpenTherm",
2627
"sensors": {
2728
"dhw_temperature": 51.2,
2829
"intended_boiler_temperature": 17.0,
2930
"modulation_level": 0.0,
3031
"return_temperature": 21.7,
31-
"water_pressure": 1.2,
32-
"water_temperature": 23.6
32+
"water_pressure": 1.2
3333
},
3434
"vendor": "Bosch Thermotechniek B.V."
3535
},
@@ -44,7 +44,13 @@
4444
"location": "0000aaaa0000aaaa0000aaaa0000aa00",
4545
"model": "ThermoTouch",
4646
"name": "Anna",
47-
"preset_modes": ["away", "vacation", "asleep", "home", "no_frost"],
47+
"preset_modes": [
48+
"away",
49+
"vacation",
50+
"asleep",
51+
"home",
52+
"no_frost"
53+
],
4854
"select_schedule": null,
4955
"sensors": {
5056
"illuminance": 150.8,

tests/data/anna/legacy_anna_2.json

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"9e7377867dc24e51b8098a5ba02bd89d": {
33
"active_preset": null,
4-
"available_schedules": ["Thermostat schedule", "off"],
4+
"available_schedules": [
5+
"Thermostat schedule",
6+
"off"
7+
],
58
"climate_mode": "heat",
69
"control_state": "idle",
710
"dev_class": "thermostat",
@@ -10,7 +13,13 @@
1013
"location": "be81e3f8275b4129852c4d8d550ae2eb",
1114
"model": "ThermoTouch",
1215
"name": "Anna",
13-
"preset_modes": ["vacation", "away", "no_frost", "home", "asleep"],
16+
"preset_modes": [
17+
"vacation",
18+
"away",
19+
"no_frost",
20+
"home",
21+
"asleep"
22+
],
1423
"select_schedule": "off",
1524
"sensors": {
1625
"illuminance": 19.5,
@@ -42,23 +51,23 @@
4251
"flame_state": false,
4352
"heating_state": false
4453
},
45-
"dev_class": "heater_central",
46-
"location": "be81e3f8275b4129852c4d8d550ae2eb",
47-
"maximum_boiler_temperature": {
54+
"boiler_temperature": {
55+
"current": 54.0,
4856
"lower_bound": 50.0,
4957
"resolution": 1.0,
5058
"setpoint": 70.0,
5159
"upper_bound": 90.0
5260
},
61+
"dev_class": "heater_central",
62+
"location": "be81e3f8275b4129852c4d8d550ae2eb",
5363
"model": "Generic heater",
5464
"name": "OpenTherm",
5565
"sensors": {
5666
"dhw_temperature": 0.0,
5767
"intended_boiler_temperature": 0.0,
5868
"modulation_level": 0.0,
5969
"return_temperature": 0.0,
60-
"water_pressure": 1.7,
61-
"water_temperature": 54.0
70+
"water_pressure": 1.7
6271
}
6372
}
6473
}

0 commit comments

Comments
 (0)