mirror of
https://github.com/home-assistant/core.git
synced 2025-06-16 11:07:05 +00:00
Migrate DNSIP to new entity naming style (#75197)
This commit is contained in:
parent
06e905054e
commit
48f4b51a1d
@ -52,6 +52,7 @@ class WanIpSensor(SensorEntity):
|
|||||||
"""Implementation of a DNS IP sensor."""
|
"""Implementation of a DNS IP sensor."""
|
||||||
|
|
||||||
_attr_icon = "mdi:web"
|
_attr_icon = "mdi:web"
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -61,7 +62,7 @@ class WanIpSensor(SensorEntity):
|
|||||||
ipv6: bool,
|
ipv6: bool,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the DNS IP sensor."""
|
"""Initialize the DNS IP sensor."""
|
||||||
self._attr_name = f"{name} IPv6" if ipv6 else name
|
self._attr_name = "IPv6" if ipv6 else None
|
||||||
self._attr_unique_id = f"{hostname}_{ipv6}"
|
self._attr_unique_id = f"{hostname}_{ipv6}"
|
||||||
self.hostname = hostname
|
self.hostname = hostname
|
||||||
self.resolver = aiodns.DNSResolver()
|
self.resolver = aiodns.DNSResolver()
|
||||||
@ -76,7 +77,7 @@ class WanIpSensor(SensorEntity):
|
|||||||
identifiers={(DOMAIN, f"{hostname}_{ipv6}")},
|
identifiers={(DOMAIN, f"{hostname}_{ipv6}")},
|
||||||
manufacturer="DNS",
|
manufacturer="DNS",
|
||||||
model=aiodns.__version__,
|
model=aiodns.__version__,
|
||||||
name=hostname,
|
name=name,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def async_update(self) -> None:
|
async def async_update(self) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user