mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 17:57:55 +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):
|
class PiHoleEntity(CoordinatorEntity):
|
||||||
"""Representation of a Pi-hole entity."""
|
"""Representation of a Pi-hole entity."""
|
||||||
|
|
||||||
_attr_icon: str = "mdi:pi-hole"
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
api: Hole,
|
api: Hole,
|
||||||
|
@ -29,6 +29,8 @@ async def async_setup_entry(
|
|||||||
class PiHoleBinarySensor(PiHoleEntity, BinarySensorEntity):
|
class PiHoleBinarySensor(PiHoleEntity, BinarySensorEntity):
|
||||||
"""Representation of a Pi-hole binary sensor."""
|
"""Representation of a Pi-hole binary sensor."""
|
||||||
|
|
||||||
|
_attr_icon = "mdi:pi-hole"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
"""Return the name of the sensor."""
|
"""Return the name of the sensor."""
|
||||||
|
@ -61,7 +61,6 @@ class PiHoleSensor(PiHoleEntity, SensorEntity):
|
|||||||
|
|
||||||
self._attr_name = f"{name} {description.name}"
|
self._attr_name = f"{name} {description.name}"
|
||||||
self._attr_unique_id = f"{self._server_unique_id}/{description.name}"
|
self._attr_unique_id = f"{self._server_unique_id}/{description.name}"
|
||||||
self._attr_icon = description.icon # Necessary to overwrite inherited value
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self) -> Any:
|
def state(self) -> Any:
|
||||||
|
@ -58,6 +58,8 @@ async def async_setup_entry(
|
|||||||
class PiHoleSwitch(PiHoleEntity, SwitchEntity):
|
class PiHoleSwitch(PiHoleEntity, SwitchEntity):
|
||||||
"""Representation of a Pi-hole switch."""
|
"""Representation of a Pi-hole switch."""
|
||||||
|
|
||||||
|
_attr_icon = "mdi:pi-hole"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
"""Return the name of the switch."""
|
"""Return the name of the switch."""
|
||||||
@ -68,11 +70,6 @@ class PiHoleSwitch(PiHoleEntity, SwitchEntity):
|
|||||||
"""Return the unique id of the switch."""
|
"""Return the unique id of the switch."""
|
||||||
return f"{self._server_unique_id}/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
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
"""Return if the service is on."""
|
"""Return if the service is on."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user