Skip to content

Commit

Permalink
Merge pull request #150 from chris-y/entityid
Browse files Browse the repository at this point in the history
Set unique_id before passing it to entity_id
  • Loading branch information
Andrey "Limych" Khrolenok authored May 2, 2024
2 parents e4c2500 + 270452a commit 6e0ad35
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 6e0ad35

Please sign in to comment.