diff --git a/custom_components/monitor_docker/button.py b/custom_components/monitor_docker/button.py index 0f1dc89..16756a6 100644 --- a/custom_components/monitor_docker/button.py +++ b/custom_components/monitor_docker/button.py @@ -183,7 +183,10 @@ def __init__( self._attr_unique_id = ENTITY_ID_FORMAT.format( slugify(f"{self._instance}_{self._cname}_restart") ) - self._attr_name = f"{self._instance} {self._cname} Restart" + + self._attr_has_entity_name = True + self._attr_name = "Restart container" + self.entity_id = f"button.{self._instance}_{self._cname}_restart" self._removed = False @property @@ -192,7 +195,7 @@ def should_poll(self) -> bool: @property def icon(self) -> str: - return "mdi:docker" + return "mdi:restart" @property def extra_state_attributes(self) -> dict: diff --git a/custom_components/monitor_docker/helpers.py b/custom_components/monitor_docker/helpers.py index e68b4a6..35cf43e0 100644 --- a/custom_components/monitor_docker/helpers.py +++ b/custom_components/monitor_docker/helpers.py @@ -1664,7 +1664,7 @@ def __init__( container_info = container.get_info() self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, f"{instance}_container_{cname}")}, - name=cname, + name=cname.capitalize(), manufacturer="Docker", model="Docker Container", entry_type=DeviceEntryType.SERVICE, diff --git a/custom_components/monitor_docker/sensor.py b/custom_components/monitor_docker/sensor.py index 72a0ba4..9c0f050 100644 --- a/custom_components/monitor_docker/sensor.py +++ b/custom_components/monitor_docker/sensor.py @@ -301,14 +301,14 @@ def __init__( self._attr_unique_id = ENTITY_ID_FORMAT.format( slugify(f"{self._instance}_{self._cname}_allinone") ) - self._attr_name = f"{self._instance} {self._cname} AllInOne".strip() + self._attr_name = "AllInOne" + self.entity_id = f"sensor.{self._instance}_{self._cname}_allinone".replace(" ", "") else: self._attr_unique_id = ENTITY_ID_FORMAT.format( slugify(f"{self._instance}_{cname}_{self.entity_description.name}") ) - self._attr_name = ( - f"{self._instance} {self._cname} {self.entity_description.name}".strip() - ) + self._attr_name = self.entity_description.name + self.entity_id = f"sensor.{self._instance}_{self._cname}_{self.entity_description.name}".replace(" ", "") self._state = None self._state_extra = None diff --git a/custom_components/monitor_docker/switch.py b/custom_components/monitor_docker/switch.py index 106737c..cdfa888 100644 --- a/custom_components/monitor_docker/switch.py +++ b/custom_components/monitor_docker/switch.py @@ -182,13 +182,12 @@ def __init__( self._attr_unique_id: str = ENTITY_ID_FORMAT.format( slugify(f"{self._instance}_{self._cname}") ) - self._name = f"{self._instance} {self._cname}" - self._removed = False + self._name = self._cname.capitalize() + self._attr_has_entity_name = True + self._attr_name = None - @property - def name(self) -> str: - """Return the name of the sensor.""" - return self._name + self.entity_id = f"switch.{self._instance}_{self._cname}" + self._removed = False @property def should_poll(self) -> bool: