Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions custom_components/monitor_docker/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/monitor_docker/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions custom_components/monitor_docker/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions custom_components/monitor_docker/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down