Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c2e4ffd
Improve support for groups
bouwew Nov 24, 2025
834084c
Update test-json
bouwew Nov 24, 2025
9de4460
Update test asserts
bouwew Nov 24, 2025
f294716
Update test-json 2
bouwew Nov 24, 2025
24af1d9
Collect group sensors
bouwew Nov 25, 2025
51ced41
Debug log
bouwew Nov 25, 2025
a441b8c
Improve find
bouwew Nov 25, 2025
0645a21
Add GROUP_MEASUREMENTS constant
bouwew Nov 25, 2025
0d93f01
Try
bouwew Nov 25, 2025
2cffa09
Debug 2
bouwew Nov 25, 2025
1487964
Add count, debug 3
bouwew Nov 25, 2025
7ce779a
Reorder, add debug 4
bouwew Nov 26, 2025
fb23596
Add _collect_group_sensors() function
bouwew Nov 26, 2025
4055020
Update test-json
bouwew Nov 26, 2025
c31e58e
fixup: improve_group Python code fixed using ruff
Nov 26, 2025
3a3bdec
Cleanup, improve docstring
bouwew Nov 26, 2025
33b9b4e
Update test-json
bouwew Nov 26, 2025
4c59065
Update entity_items assert
bouwew Nov 26, 2025
d359a35
Update test-json 2
bouwew Nov 26, 2025
6f2efcf
Update entity_items 2
bouwew Nov 26, 2025
3e69b8a
Update test-json 3
bouwew Nov 26, 2025
4f50c89
Update entity_items 3
bouwew Nov 26, 2025
a1ff1ab
Save test-jsons 4
bouwew Nov 26, 2025
6dd37ae
Save updated fixtures
bouwew Nov 26, 2025
1fc00c0
Typing fix
bouwew Nov 26, 2025
627958c
Rework to avoid extra testcode
bouwew Nov 26, 2025
088cde8
Save various updates
bouwew Nov 26, 2025
f224ad5
Add biome.json config file
bouwew Nov 26, 2025
97626a0
Update CHANGELOG
bouwew Nov 26, 2025
79a3835
Bump to v1.11.0a0 for testing
bouwew Nov 26, 2025
04c9722
Clean up, as suggested
bouwew Nov 26, 2025
08821db
Fix biome.json formatting
bouwew Nov 26, 2025
78f10a3
Make sure to continue for-loop as suggested
bouwew Nov 26, 2025
65c9bc5
Update test-json
bouwew Nov 26, 2025
c7656c0
Correct entity_item assert
bouwew Nov 26, 2025
79fa87d
Update 2nd test-json
bouwew Nov 26, 2025
9ad26a4
Correct 2nd entity_items assert
bouwew Nov 26, 2025
65d83b3
Save updated fixtures
bouwew Nov 26, 2025
d60d944
Bump to a1
bouwew Nov 26, 2025
dd598d2
Set to v1.11.0 release-version
bouwew Nov 26, 2025
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.11.0

- Extend feature: support pumping group, add group sensors

## v1.10.0

- New feature: implement setting Adam zone profile via PR [#814](https://github.com/plugwise/python-plugwise/pull/814)
Expand Down
5 changes: 5 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files": {
"maxSize": 5000000
}
}
20 changes: 19 additions & 1 deletion fixtures/adam_multiple_devices_per_zone/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,20 @@
"vendor": "Plugwise",
"zigbee_mac_address": "ABCD012345670A06"
},
"e117db6848394c8cb70d9c28e63d92d2": {
"dev_class": "pumping",
"members": [
"78d1126fc4c743db81b61c20e88342a7",
"b59bcebaf94b499ea7d46e4a66fb62d8"
],
"model": "Group",
"name": "Vloerverwarming Woonkamer",
"sensors": {
"electricity_consumed": 35.6,
"temperature": 20.9
},
"vendor": "Plugwise"
},
"e7693eb9582644e5b865dba8d4447cf1": {
"available": true,
"binary_sensors": {
Expand Down Expand Up @@ -546,8 +560,12 @@
"02cf28bfec924855854c544690a609ef",
"4a810418d5394b3f82727340b91ba740"
],
"model": "Switchgroup",
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 14.8,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
Expand Down
21 changes: 20 additions & 1 deletion fixtures/adam_plus_anna_new/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,21 @@
},
"vendor": "Plugwise"
},
"c9293d1d68ee48fc8843c6f0dee2b6be": {
"dev_class": "pumping",
"members": [
"854f8a9b0e7e425db97f1f110e1ce4b3",
"ad4838d7d35c4d6ea796ee12ae5aedf8"
],
"model": "Group",
"name": "Vloerverwarming",
"sensors": {
"electricity_consumed": 45.0,
"electricity_produced": 0.0,
"temperature": 20.1
},
"vendor": "Plugwise"
},
"da224107914542988a88561b4452b0f6": {
"binary_sensors": {
"plugwise_notification": false
Expand Down Expand Up @@ -257,8 +272,12 @@
"2568cc4b9c1e401495d4741a5f89bee1",
"29542b2b6a6a4169acecc15c72a599b8"
],
"model": "Switchgroup",
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 16.5,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
Expand Down
21 changes: 20 additions & 1 deletion fixtures/adam_plus_anna_new_regulation_off/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@
},
"vendor": "Plugwise"
},
"c9293d1d68ee48fc8843c6f0dee2b6be": {
"dev_class": "pumping",
"members": [
"854f8a9b0e7e425db97f1f110e1ce4b3",
"ad4838d7d35c4d6ea796ee12ae5aedf8"
],
"model": "Group",
"name": "Vloerverwarming",
"sensors": {
"electricity_consumed": 43.8,
"electricity_produced": 0.0,
"temperature": 18.4
},
"vendor": "Plugwise"
},
"da224107914542988a88561b4452b0f6": {
"binary_sensors": {
"plugwise_notification": false
Expand Down Expand Up @@ -210,8 +225,12 @@
"2568cc4b9c1e401495d4741a5f89bee1",
"29542b2b6a6a4169acecc15c72a599b8"
],
"model": "Switchgroup",
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 14.8,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
Expand Down
14 changes: 14 additions & 0 deletions fixtures/adam_zone_per_device/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,20 @@
"vendor": "Plugwise",
"zigbee_mac_address": "ABCD012345670A06"
},
"e117db6848394c8cb70d9c28e63d92d2": {
"dev_class": "pumping",
"members": [
"78d1126fc4c743db81b61c20e88342a7",
"b59bcebaf94b499ea7d46e4a66fb62d8"
],
"model": "Group",
"name": "Vloerverwarming Woonkamer",
"sensors": {
"electricity_consumed": 35.8,
"temperature": 21.1
},
"vendor": "Plugwise"
},
"e7693eb9582644e5b865dba8d4447cf1": {
"available": true,
"binary_sensors": {
Expand Down
21 changes: 20 additions & 1 deletion fixtures/m_adam_cooling/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@
},
"vendor": "Plugwise"
},
"c9293d1d68ee48fc8843c6f0dee2b6be": {
"dev_class": "pumping",
"members": [
"854f8a9b0e7e425db97f1f110e1ce4b3",
"ad4838d7d35c4d6ea796ee12ae5aedf8"
],
"model": "Group",
"name": "Vloerverwarming",
"sensors": {
"electricity_consumed": 45.0,
"electricity_produced": 0.0,
"temperature": 20.1
},
"vendor": "Plugwise"
},
"da224107914542988a88561b4452b0f6": {
"binary_sensors": {
"plugwise_notification": false
Expand Down Expand Up @@ -173,8 +188,12 @@
"2568cc4b9c1e401495d4741a5f89bee1",
"29542b2b6a6a4169acecc15c72a599b8"
],
"model": "Switchgroup",
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 16.5,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
Expand Down
21 changes: 20 additions & 1 deletion fixtures/m_adam_heating/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@
},
"vendor": "Plugwise"
},
"c9293d1d68ee48fc8843c6f0dee2b6be": {
"dev_class": "pumping",
"members": [
"854f8a9b0e7e425db97f1f110e1ce4b3",
"ad4838d7d35c4d6ea796ee12ae5aedf8"
],
"model": "Group",
"name": "Vloerverwarming",
"sensors": {
"electricity_consumed": 45.0,
"electricity_produced": 0.0,
"temperature": 20.1
},
"vendor": "Plugwise"
},
"da224107914542988a88561b4452b0f6": {
"binary_sensors": {
"plugwise_notification": false
Expand Down Expand Up @@ -172,8 +187,12 @@
"2568cc4b9c1e401495d4741a5f89bee1",
"29542b2b6a6a4169acecc15c72a599b8"
],
"model": "Switchgroup",
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 16.5,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
Expand Down
20 changes: 19 additions & 1 deletion fixtures/m_adam_multiple_devices_per_zone/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,20 @@
"vendor": "Plugwise",
"zigbee_mac_address": "ABCD012345670A06"
},
"e117db6848394c8cb70d9c28e63d92d2": {
"dev_class": "pumping",
"members": [
"78d1126fc4c743db81b61c20e88342a7",
"b59bcebaf94b499ea7d46e4a66fb62d8"
],
"model": "Group",
"name": "Vloerverwarming Woonkamer",
"sensors": {
"electricity_consumed": 35.6,
"temperature": 20.9
},
"vendor": "Plugwise"
},
"e7693eb9582644e5b865dba8d4447cf1": {
"available": true,
"binary_sensors": {
Expand Down Expand Up @@ -539,8 +553,12 @@
"02cf28bfec924855854c544690a609ef",
"4a810418d5394b3f82727340b91ba740"
],
"model": "Switchgroup",
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 14.8,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
Expand Down
2 changes: 1 addition & 1 deletion fixtures/stretch_v23/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
"f7b145c8492f4dd7a4de760456fdef3e": {
"dev_class": "switching",
"members": ["407aa1c1099d463c9137a3a9eda787fd"],
"model": "Switchgroup",
"model": "Group",
"name": "Test",
"switches": {
"relay": false
Expand Down
4 changes: 2 additions & 2 deletions fixtures/stretch_v31/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"059e4d03c7a34d278add5c7a4a781d19",
"cfe95cf3de1948c0b8955125bf754614"
],
"model": "Switchgroup",
"model": "Group",
"name": "Schakel",
"switches": {
"relay": true
Expand All @@ -107,7 +107,7 @@
"cfe95cf3de1948c0b8955125bf754614",
"e1c884e7dede431dadee09506ec4f859"
],
"model": "Switchgroup",
"model": "Group",
"name": "Stroomvreters",
"switches": {
"relay": true
Expand Down
19 changes: 10 additions & 9 deletions plugwise/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from plugwise.constants import (
ANNA,
GROUP_TYPES,
NONE,
PRIORITY_DEVICE_CLASSES,
SPECIAL_PLUG_TYPES,
Expand Down Expand Up @@ -187,15 +188,15 @@ def _entity_switching_group(self, entity: GwEntityData, data: GwEntityData) -> N
data["switches"]["relay"] = counter != 0
self._count += 1

def _get_group_switches(self) -> dict[str, GwEntityData]:
def _get_groups(self) -> dict[str, GwEntityData]:
"""Helper-function for smile.py: get_all_gateway_entities().

Collect switching- or pump-group info.
Collect switching-, pumping- or report-group info.
"""
switch_groups: dict[str, GwEntityData] = {}
# P1 and Anna don't have switchgroups
groups: dict[str, GwEntityData] = {}
# P1 and Anna don't have groups
if self.smile.type == "power" or self.check_name(ANNA):
return switch_groups
return groups

for group in self._domain_objects.findall("./group"):
members: list[str] = []
Expand All @@ -208,17 +209,17 @@ def _get_group_switches(self) -> dict[str, GwEntityData]:
if item.attrib["id"] in self.gw_entities:
members.append(item.attrib["id"])

if group_type in SWITCH_GROUP_TYPES and members:
switch_groups[group_id] = {
if group_type in GROUP_TYPES and members:
groups[group_id] = {
"dev_class": group_type,
"model": "Switchgroup",
"model": "Group",
"name": group_name,
"members": members,
"vendor": "Plugwise",
}
self._count += 5

return switch_groups
return groups

def _get_lock_state(
self, xml: etree.Element, data: GwEntityData, stretch_v2: bool = False
Expand Down
7 changes: 7 additions & 0 deletions plugwise/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@
UOM = namedtuple("UOM", "unit_of_measurement")
DATA = namedtuple("DATA", "name unit_of_measurement")

GROUP_MEASUREMENTS: Final[dict[str, UOM]] = {
"electricity_consumed": UOM(POWER_WATT),
"electricity_produced": UOM(POWER_WATT),
"temperature": UOM(TEMP_CELSIUS),
}
# P1 related measurements:
P1_MEASUREMENTS: Final[dict[str, UOM]] = {
"electricity_consumed": UOM(POWER_WATT),
Expand Down Expand Up @@ -299,6 +304,8 @@
]
BINARY_SENSORS: Final[tuple[str, ...]] = get_args(BinarySensorType)

GROUP_TYPES: Final[tuple[str, ...]] = ("pumping", "report", "switching")

SensorType = Literal[
"battery",
"cooling_activation_outdoor_temperature",
Expand Down
Loading