Skip to content
Closed
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Ongoing

- Remove switching groups

## v1.11.0

- Extend feature: support pumping group, add group sensors
Expand Down
17 changes: 0 additions & 17 deletions fixtures/adam_multiple_devices_per_zone/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -554,23 +554,6 @@
"vendor": "Plugwise",
"zigbee_mac_address": "ABCD012345670A11"
},
"e8ef2a01ed3b4139a53bf749204fe6b4": {
"dev_class": "switching",
"members": [
"02cf28bfec924855854c544690a609ef",
"4a810418d5394b3f82727340b91ba740"
],
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 14.8,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
"vendor": "Plugwise"
},
"f1fee6043d3642a9b0a65297455f008e": {
"available": true,
"binary_sensors": {
Expand Down
17 changes: 0 additions & 17 deletions fixtures/adam_plus_anna_new/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,23 +266,6 @@
"vendor": "Plugwise",
"zigbee_mac_address": "000D6F000C86CBA0"
},
"e8ef2a01ed3b4139a53bf749204fe6b4": {
"dev_class": "switching",
"members": [
"2568cc4b9c1e401495d4741a5f89bee1",
"29542b2b6a6a4169acecc15c72a599b8"
],
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 16.5,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
"vendor": "Plugwise"
},
"f2bf9048bef64cc5b6d5110154e33c81": {
"active_preset": "home",
"available_schedules": [
Expand Down
17 changes: 0 additions & 17 deletions fixtures/adam_plus_anna_new_regulation_off/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,23 +219,6 @@
"vendor": "Plugwise",
"zigbee_mac_address": "000D6F000C869B61"
},
"e8ef2a01ed3b4139a53bf749204fe6b4": {
"dev_class": "switching",
"members": [
"2568cc4b9c1e401495d4741a5f89bee1",
"29542b2b6a6a4169acecc15c72a599b8"
],
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 14.8,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
"vendor": "Plugwise"
},
"f2bf9048bef64cc5b6d5110154e33c81": {
"active_preset": "home",
"available_schedules": [
Expand Down
17 changes: 0 additions & 17 deletions fixtures/m_adam_cooling/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,6 @@
"vendor": "Plugwise",
"zigbee_mac_address": "000D6F000C86CBA0"
},
"e8ef2a01ed3b4139a53bf749204fe6b4": {
"dev_class": "switching",
"members": [
"2568cc4b9c1e401495d4741a5f89bee1",
"29542b2b6a6a4169acecc15c72a599b8"
],
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 16.5,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
"vendor": "Plugwise"
},
"f2bf9048bef64cc5b6d5110154e33c81": {
"active_preset": "home",
"available_schedules": [
Expand Down
17 changes: 0 additions & 17 deletions fixtures/m_adam_heating/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,23 +181,6 @@
"vendor": "Plugwise",
"zigbee_mac_address": "000D6F000C86CBA0"
},
"e8ef2a01ed3b4139a53bf749204fe6b4": {
"dev_class": "switching",
"members": [
"2568cc4b9c1e401495d4741a5f89bee1",
"29542b2b6a6a4169acecc15c72a599b8"
],
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 16.5,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
"vendor": "Plugwise"
},
"f2bf9048bef64cc5b6d5110154e33c81": {
"active_preset": "home",
"available_schedules": [
Expand Down
17 changes: 0 additions & 17 deletions fixtures/m_adam_multiple_devices_per_zone/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -547,23 +547,6 @@
"vendor": "Plugwise",
"zigbee_mac_address": "ABCD012345670A11"
},
"e8ef2a01ed3b4139a53bf749204fe6b4": {
"dev_class": "switching",
"members": [
"02cf28bfec924855854c544690a609ef",
"4a810418d5394b3f82727340b91ba740"
],
"model": "Group",
"name": "Test",
"sensors": {
"electricity_consumed": 14.8,
"electricity_produced": 0.0
},
"switches": {
"relay": true
},
"vendor": "Plugwise"
},
"f1fee6043d3642a9b0a65297455f008e": {
"available": true,
"binary_sensors": {
Expand Down
10 changes: 0 additions & 10 deletions fixtures/stretch_v23/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,6 @@
"vendor": "Plugwise",
"zigbee_mac_address": "ABCD012345670A11"
},
"f7b145c8492f4dd7a4de760456fdef3e": {
"dev_class": "switching",
"members": ["407aa1c1099d463c9137a3a9eda787fd"],
"model": "Group",
"name": "Test",
"switches": {
"relay": false
},
"vendor": "Plugwise"
},
"fd1b74f59e234a9dae4e23b2b5cf07ed": {
"dev_class": "dryer",
"firmware": "2011-06-27T10:52:18+02:00",
Expand Down
29 changes: 0 additions & 29 deletions fixtures/stretch_v31/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,35 +85,6 @@
"vendor": "Plugwise",
"zigbee_mac_address": "ABCD012345670A04"
},
"d03738edfcc947f7b8f4573571d90d2d": {
"dev_class": "switching",
"members": [
"059e4d03c7a34d278add5c7a4a781d19",
"cfe95cf3de1948c0b8955125bf754614"
],
"model": "Group",
"name": "Schakel",
"switches": {
"relay": true
},
"vendor": "Plugwise"
},
"d950b314e9d8499f968e6db8d82ef78c": {
"dev_class": "report",
"members": [
"059e4d03c7a34d278add5c7a4a781d19",
"5871317346d045bc9f6b987ef25ee638",
"aac7b735042c4832ac9ff33aae4f453b",
"cfe95cf3de1948c0b8955125bf754614",
"e1c884e7dede431dadee09506ec4f859"
],
"model": "Group",
"name": "Stroomvreters",
"switches": {
"relay": true
},
"vendor": "Plugwise"
},
"e1c884e7dede431dadee09506ec4f859": {
"dev_class": "refrigerator",
"firmware": "2011-06-27T10:47:37+02:00",
Expand Down
8 changes: 2 additions & 6 deletions plugwise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,7 @@ async def set_temperature_offset(self, dev_id: str, offset: float) -> None:
f"Failed to set temperature offset: {str(exc)}"
) from exc # pragma no cover

async def set_switch_state(
self, appl_id: str, members: list[str] | None, model: str, state: str
) -> bool:
async def set_switch_state(self, appl_id: str, model: str, state: str) -> bool:
"""Set the given State of the relevant Switch.

Return the result:
Expand All @@ -422,9 +420,7 @@ async def set_switch_state(
raise PlugwiseError("Invalid state supplied to set_switch_state")

try:
return await self._smile_api.set_switch_state(
appl_id, members, model, state
)
return await self._smile_api.set_switch_state(appl_id, model, state)
except ConnectionFailedError as exc:
raise ConnectionFailedError(
f"Failed to set switch state: {str(exc)}"
Expand Down
28 changes: 8 additions & 20 deletions plugwise/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

from plugwise.constants import (
ANNA,
GROUP_TYPES,
NONE,
PRIORITY_DEVICE_CLASSES,
SPECIAL_PLUG_TYPES,
SWITCH_GROUP_TYPES,
ApplianceType,
GwEntityData,
ModuleData,
Expand Down Expand Up @@ -175,41 +173,31 @@ def _reorder_devices(self) -> None:
break
self.gw_entities = {**reordered, **self.gw_entities}

def _entity_switching_group(self, entity: GwEntityData, data: GwEntityData) -> None:
"""Helper-function for _get_device_zone_data().

Determine switching group device data.
"""
if entity["dev_class"] in SWITCH_GROUP_TYPES:
counter = 0
for member in entity["members"]:
if self.gw_entities[member]["switches"].get("relay"):
counter += 1
data["switches"]["relay"] = counter != 0
self._count += 1

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

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

for group in self._domain_objects.findall("./group"):
members: list[str] = []
group_id = group.attrib["id"]
group_name = group.find("name").text
group_type = group.find("type").text
if group_type != "pumping":
continue

group_appliances = group.findall("appliances/appliance")
group_id = group.attrib["id"]
group_name = group.find("name").text
members: list[str] = []
for item in group_appliances:
# Check if members are not orphaned - stretch
if item.attrib["id"] in self.gw_entities:
members.append(item.attrib["id"])

if group_type in GROUP_TYPES and members:
if members:
groups[group_id] = {
"dev_class": group_type,
"model": "Group",
Expand Down
4 changes: 0 additions & 4 deletions plugwise/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,6 @@
]
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 Expand Up @@ -384,8 +382,6 @@
]
SWITCHES: Final[tuple[str, ...]] = get_args(SwitchType)

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

THERMOSTAT_CLASSES: Final[tuple[str, ...]] = (
"thermostat",
"thermostatic_radiator_valve",
Expand Down
6 changes: 2 additions & 4 deletions plugwise/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,16 @@ def _get_entity_data(self, entity_id: str) -> GwEntityData:
data = self._get_measurement_data(entity_id)

# Check availability of wired-connected entities
# Smartmeter
# Smartmeter entity:
self._check_availability(
entity, "smartmeter", data, "P1 does not seem to be connected"
)
# OpenTherm entity
# OpenTherm entity:
if entity["name"] != "OnOff":
self._check_availability(
entity, "heater_central", data, "no OpenTherm communication"
)

# Switching groups data
self._entity_switching_group(entity, data)
# Adam data
if self.check_name(ADAM):
self._get_adam_data(entity, data)
Expand Down
3 changes: 0 additions & 3 deletions plugwise/legacy/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ def _get_entity_data(self, entity_id: str) -> GwEntityData:
entity = self.gw_entities[entity_id]
data = self._get_measurement_data(entity_id)

# Switching groups data
self._entity_switching_group(entity, data)

# Skip obtaining data when not a thermostat
if entity["dev_class"] != "thermostat":
return data
Expand Down
Loading