From d360b83a269b59c4b6381b9da4bb843ee637ce7b Mon Sep 17 00:00:00 2001 From: "firstof9@gmail.com" Date: Mon, 23 Dec 2024 14:33:59 -0700 Subject: [PATCH] compact unique_id into `self._attr` format --- custom_components/nws_alerts/sensor.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/custom_components/nws_alerts/sensor.py b/custom_components/nws_alerts/sensor.py index 1538f0f..0bed848 100644 --- a/custom_components/nws_alerts/sensor.py +++ b/custom_components/nws_alerts/sensor.py @@ -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: