Skip to content

Commit

Permalink
Set unique_id before passing it to entity_id
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-y committed Apr 12, 2024
1 parent e4c2500 commit 270452a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/iaquk/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def __init__(self, controller, sensor_type: str):
"""Initialize sensor."""
self._controller = controller
self._sensor_type = sensor_type
self._attr_unique_id = f"{controller.unique_id}_{sensor_type}"

self.entity_id = async_generate_entity_id(
ENTITY_ID_FORMAT, self._attr_unique_id, hass=controller.hass
)

self._attr_unique_id = f"{controller.unique_id}_{sensor_type}"
self._attr_name = f"{controller.name} {SENSORS[sensor_type]}"
self._attr_state_class = (
SensorStateClass.MEASUREMENT if sensor_type == SENSOR_INDEX else None
Expand Down

0 comments on commit 270452a

Please sign in to comment.