mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 10:47:10 +00:00
Remove own sensor description in PI-Hole (#85371)
own sensor description is not needed anymor
This commit is contained in:
parent
0fbb334ad9
commit
dddba4ba45
@ -1,7 +1,6 @@
|
|||||||
"""Support for getting statistical data from a Pi-hole system."""
|
"""Support for getting statistical data from a Pi-hole system."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from hole import Hole
|
from hole import Hole
|
||||||
@ -21,64 +20,56 @@ from .const import (
|
|||||||
DOMAIN as PIHOLE_DOMAIN,
|
DOMAIN as PIHOLE_DOMAIN,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
@dataclass
|
SensorEntityDescription(
|
||||||
class PiHoleSensorEntityDescription(SensorEntityDescription):
|
|
||||||
"""Describes PiHole sensor entity."""
|
|
||||||
|
|
||||||
icon: str = "mdi:pi-hole"
|
|
||||||
|
|
||||||
|
|
||||||
SENSOR_TYPES: tuple[PiHoleSensorEntityDescription, ...] = (
|
|
||||||
PiHoleSensorEntityDescription(
|
|
||||||
key="ads_blocked_today",
|
key="ads_blocked_today",
|
||||||
name="Ads Blocked Today",
|
name="Ads Blocked Today",
|
||||||
native_unit_of_measurement="ads",
|
native_unit_of_measurement="ads",
|
||||||
icon="mdi:close-octagon-outline",
|
icon="mdi:close-octagon-outline",
|
||||||
),
|
),
|
||||||
PiHoleSensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="ads_percentage_today",
|
key="ads_percentage_today",
|
||||||
name="Ads Percentage Blocked Today",
|
name="Ads Percentage Blocked Today",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
icon="mdi:close-octagon-outline",
|
icon="mdi:close-octagon-outline",
|
||||||
),
|
),
|
||||||
PiHoleSensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="clients_ever_seen",
|
key="clients_ever_seen",
|
||||||
name="Seen Clients",
|
name="Seen Clients",
|
||||||
native_unit_of_measurement="clients",
|
native_unit_of_measurement="clients",
|
||||||
icon="mdi:account-outline",
|
icon="mdi:account-outline",
|
||||||
),
|
),
|
||||||
PiHoleSensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="dns_queries_today",
|
key="dns_queries_today",
|
||||||
name="DNS Queries Today",
|
name="DNS Queries Today",
|
||||||
native_unit_of_measurement="queries",
|
native_unit_of_measurement="queries",
|
||||||
icon="mdi:comment-question-outline",
|
icon="mdi:comment-question-outline",
|
||||||
),
|
),
|
||||||
PiHoleSensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="domains_being_blocked",
|
key="domains_being_blocked",
|
||||||
name="Domains Blocked",
|
name="Domains Blocked",
|
||||||
native_unit_of_measurement="domains",
|
native_unit_of_measurement="domains",
|
||||||
icon="mdi:block-helper",
|
icon="mdi:block-helper",
|
||||||
),
|
),
|
||||||
PiHoleSensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="queries_cached",
|
key="queries_cached",
|
||||||
name="DNS Queries Cached",
|
name="DNS Queries Cached",
|
||||||
native_unit_of_measurement="queries",
|
native_unit_of_measurement="queries",
|
||||||
icon="mdi:comment-question-outline",
|
icon="mdi:comment-question-outline",
|
||||||
),
|
),
|
||||||
PiHoleSensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="queries_forwarded",
|
key="queries_forwarded",
|
||||||
name="DNS Queries Forwarded",
|
name="DNS Queries Forwarded",
|
||||||
native_unit_of_measurement="queries",
|
native_unit_of_measurement="queries",
|
||||||
icon="mdi:comment-question-outline",
|
icon="mdi:comment-question-outline",
|
||||||
),
|
),
|
||||||
PiHoleSensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="unique_clients",
|
key="unique_clients",
|
||||||
name="DNS Unique Clients",
|
name="DNS Unique Clients",
|
||||||
native_unit_of_measurement="clients",
|
native_unit_of_measurement="clients",
|
||||||
icon="mdi:account-outline",
|
icon="mdi:account-outline",
|
||||||
),
|
),
|
||||||
PiHoleSensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="unique_domains",
|
key="unique_domains",
|
||||||
name="DNS Unique Domains",
|
name="DNS Unique Domains",
|
||||||
native_unit_of_measurement="domains",
|
native_unit_of_measurement="domains",
|
||||||
@ -109,7 +100,7 @@ async def async_setup_entry(
|
|||||||
class PiHoleSensor(PiHoleEntity, SensorEntity):
|
class PiHoleSensor(PiHoleEntity, SensorEntity):
|
||||||
"""Representation of a Pi-hole sensor."""
|
"""Representation of a Pi-hole sensor."""
|
||||||
|
|
||||||
entity_description: PiHoleSensorEntityDescription
|
entity_description: SensorEntityDescription
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -117,7 +108,7 @@ class PiHoleSensor(PiHoleEntity, SensorEntity):
|
|||||||
coordinator: DataUpdateCoordinator,
|
coordinator: DataUpdateCoordinator,
|
||||||
name: str,
|
name: str,
|
||||||
server_unique_id: str,
|
server_unique_id: str,
|
||||||
description: PiHoleSensorEntityDescription,
|
description: SensorEntityDescription,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize a Pi-hole sensor."""
|
"""Initialize a Pi-hole sensor."""
|
||||||
super().__init__(api, coordinator, name, server_unique_id)
|
super().__init__(api, coordinator, name, server_unique_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user