Skip to content

Commit

Permalink
fixing broken logic on unit of measurement popularity contest (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
jseidl authored Sep 3, 2024
1 parent 49cca44 commit 226eade
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions custom_components/magic_areas/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ def create_aggregate_sensors(area: MagicArea) -> list[Entity]:

# Dictionary of seen unit of measurements by device class.
if device_class not in unit_of_measurement_map:
unit_of_measurement_map[device_class] = entity[ATTR_UNIT_OF_MEASUREMENT]
unit_of_measurement_map[device_class] = []

eligible_entities[entity[ATTR_DEVICE_CLASS]].append(entity["entity_id"])
unit_of_measurement_map[device_class].append(entity[ATTR_UNIT_OF_MEASUREMENT])
eligible_entities[device_class].append(entity["entity_id"])

# Create aggregates
for device_class, entities in eligible_entities.items():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_threshold.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Test for aggregate (group) sensor behavior."""

import logging
import asyncio
import logging

from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
Expand Down

0 comments on commit 226eade

Please sign in to comment.