Skip to content

Commit

Permalink
compact unique_id into self._attr format
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 committed Dec 23, 2024
1 parent 9380872 commit d360b83
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions custom_components/nws_alerts/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,7 @@ def __init__(
self._attr_icon = sensor_description.icon
self._attr_name = f'{entry.data[CONF_NAME]} {sensor_description.name}'
self._attr_device_class = sensor_description.device_class

@property
def unique_id(self):
"""
Return a unique, Home Assistant friendly identifier for this entity.
"""
return f"{slugify(self._attr_name)}_{self._config.entry_id}"
self._attr_unique_id = f"{slugify(self._attr_name)}_{entry.entry_id}"

@property
def state(self) -> int | None:
Expand Down

0 comments on commit d360b83

Please sign in to comment.