diff --git a/custom_components/monitor_docker/button.py b/custom_components/monitor_docker/button.py index c653fc7..7cd58c3 100644 --- a/custom_components/monitor_docker/button.py +++ b/custom_components/monitor_docker/button.py @@ -187,12 +187,17 @@ def __init__( ) self._name = name_format.format(name=alias_name) self._removed = False + self._attr_unique_id = slugify(f"{self._instance}_{self._cname}_restart") @property def entity_id(self) -> str: """Return the entity id of the button.""" return self._entity_id + @entity_id.setter + def entity_id(self, value: str) -> None: + self._entity_id = value + @property def name(self) -> str: """Return the name of the sensor.""" diff --git a/custom_components/monitor_docker/switch.py b/custom_components/monitor_docker/switch.py index 92fa755..c22991d 100644 --- a/custom_components/monitor_docker/switch.py +++ b/custom_components/monitor_docker/switch.py @@ -188,12 +188,17 @@ def __init__( ) self._name = name_format.format(name=alias_name) self._removed = False + self._attr_unique_id = slugify(f"{self._instance}_{self._cname}_switch") @property def entity_id(self) -> str: """Return the entity id of the switch.""" return self._entity_id + @entity_id.setter + def entity_id(self, value: str) -> None: + self._entity_id = value + @property def name(self) -> str: """Return the name of the sensor."""