Refactor pi_hole icon usage (#54420)

This commit is contained in:
Marc Mueller
2021-08-10 21:14:31 +02:00
committed by GitHub
parent 08a30ed510
commit ac29571db3
4 changed files with 4 additions and 8 deletions

View File

@@ -161,8 +161,6 @@ def _async_platforms(entry: ConfigEntry) -> list[str]:
class PiHoleEntity(CoordinatorEntity):
"""Representation of a Pi-hole entity."""
_attr_icon: str = "mdi:pi-hole"
def __init__(
self,
api: Hole,

View File

@@ -29,6 +29,8 @@ async def async_setup_entry(
class PiHoleBinarySensor(PiHoleEntity, BinarySensorEntity):
"""Representation of a Pi-hole binary sensor."""
_attr_icon = "mdi:pi-hole"
@property
def name(self) -> str:
"""Return the name of the sensor."""

View File

@@ -61,7 +61,6 @@ class PiHoleSensor(PiHoleEntity, SensorEntity):
self._attr_name = f"{name} {description.name}"
self._attr_unique_id = f"{self._server_unique_id}/{description.name}"
self._attr_icon = description.icon # Necessary to overwrite inherited value
@property
def state(self) -> Any:

View File

@@ -58,6 +58,8 @@ async def async_setup_entry(
class PiHoleSwitch(PiHoleEntity, SwitchEntity):
"""Representation of a Pi-hole switch."""
_attr_icon = "mdi:pi-hole"
@property
def name(self) -> str:
"""Return the name of the switch."""
@@ -68,11 +70,6 @@ class PiHoleSwitch(PiHoleEntity, SwitchEntity):
"""Return the unique id of the switch."""
return f"{self._server_unique_id}/Switch"
@property
def icon(self) -> str:
"""Icon to use in the frontend, if any."""
return "mdi:pi-hole"
@property
def is_on(self) -> bool:
"""Return if the service is on."""