|
21 | 21 | DHW_SETPOINT, |
22 | 22 | DOMAIN_OBJECTS, |
23 | 23 | ENERGY_WATT_HOUR, |
| 24 | + GROUP_MEASUREMENTS, |
24 | 25 | HEATER_CENTRAL_MEASUREMENTS, |
25 | 26 | LOCATIONS, |
26 | 27 | LOGGER, |
@@ -339,6 +340,11 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: |
339 | 340 | if smile_is_power and not self.smile.anna_p1: |
340 | 341 | return data |
341 | 342 |
|
| 343 | + # Get group data |
| 344 | + measurements = GROUP_MEASUREMENTS |
| 345 | + if "members" in entity: |
| 346 | + self._collect_group_sensors(data, entity, entity_id, measurements) |
| 347 | + |
342 | 348 | # Get non-P1 data from APPLIANCES |
343 | 349 | measurements = DEVICE_MEASUREMENTS |
344 | 350 | if self._is_thermostat and entity_id == self.heater_id: |
@@ -370,6 +376,27 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: |
370 | 376 |
|
371 | 377 | return data |
372 | 378 |
|
| 379 | + def _collect_group_sensors( |
| 380 | + self, |
| 381 | + data: GwEntityData, |
| 382 | + entity: GwEntityData, |
| 383 | + entity_id: str, |
| 384 | + measurements: dict[str, DATA | UOM], |
| 385 | + ) -> None: |
| 386 | + """Collect group sensors.""" |
| 387 | + if ( |
| 388 | + group := self._domain_objects.find(f'./group[@id="{entity_id}"]') |
| 389 | + ) is None: |
| 390 | + return None |
| 391 | + |
| 392 | + for measurement, attrs in measurements.items(): |
| 393 | + locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' |
| 394 | + if (group_meas_loc := group.find(locator)) is None: |
| 395 | + return |
| 396 | + |
| 397 | + common_match_cases(measurement, attrs, group_meas_loc, data) |
| 398 | + self._count += 1 |
| 399 | + |
373 | 400 | def _collect_appliance_data( |
374 | 401 | self, |
375 | 402 | data: GwEntityData, |
|
0 commit comments