Skip to content

Commit

Permalink
fix: broken group sensors in 2024.4 beta (#2162)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramstroker committed Mar 28, 2024
1 parent 8030acd commit 291c387
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion custom_components/powercalc/sensors/group.py
Expand Up @@ -405,6 +405,7 @@ def create_grouped_power_sensor(
_LOGGER.debug("Creating grouped power sensor: %s (entity_id=%s)", name, entity_id)

return GroupedPowerSensor(
hass=hass,
name=name,
entities=power_sensor_ids,
unique_id=unique_id,
Expand Down Expand Up @@ -438,6 +439,7 @@ def create_grouped_energy_sensor(
_LOGGER.debug("Creating grouped energy sensor: %s (entity_id=%s)", name, entity_id)

return GroupedEnergySensor(
hass=hass,
name=name,
entities=energy_sensor_ids,
unique_id=energy_unique_id,
Expand All @@ -456,6 +458,7 @@ class GroupedSensor(BaseEntity, RestoreSensor, SensorEntity):

def __init__(
self,
hass: HomeAssistant,
name: str,
entities: set[str],
entity_id: str,
Expand All @@ -479,7 +482,7 @@ def __init__(
self._attr_unique_id = unique_id
self.entity_id = entity_id
self.source_device_id = device_id
self._prev_state_store: PreviousStateStore = PreviousStateStore(self.hass)
self._prev_state_store: PreviousStateStore = PreviousStateStore(hass)

async def async_added_to_hass(self) -> None:
"""Register state listeners."""
Expand Down Expand Up @@ -632,6 +635,7 @@ class GroupedEnergySensor(GroupedSensor, EnergySensor):

def __init__(
self,
hass: HomeAssistant,
name: str,
entities: set[str],
entity_id: str,
Expand All @@ -641,6 +645,7 @@ def __init__(
device_id: str | None = None,
) -> None:
super().__init__(
hass,
name,
entities,
entity_id,
Expand Down

0 comments on commit 291c387

Please sign in to comment.