mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Refactor pi_hole icon usage (#54420)
This commit is contained in:
parent
08a30ed510
commit
ac29571db3
@ -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,
|
||||
|
@ -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."""
|
||||
|
@ -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:
|
||||
|
@ -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."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user