mirror of
https://github.com/home-assistant/core.git
synced 2025-11-13 04:50:17 +00:00
Migrate DNSIP to new entity naming style (#75197)
This commit is contained in:
@@ -52,6 +52,7 @@ class WanIpSensor(SensorEntity):
|
||||
"""Implementation of a DNS IP sensor."""
|
||||
|
||||
_attr_icon = "mdi:web"
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -61,7 +62,7 @@ class WanIpSensor(SensorEntity):
|
||||
ipv6: bool,
|
||||
) -> None:
|
||||
"""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.hostname = hostname
|
||||
self.resolver = aiodns.DNSResolver()
|
||||
@@ -76,7 +77,7 @@ class WanIpSensor(SensorEntity):
|
||||
identifiers={(DOMAIN, f"{hostname}_{ipv6}")},
|
||||
manufacturer="DNS",
|
||||
model=aiodns.__version__,
|
||||
name=hostname,
|
||||
name=name,
|
||||
)
|
||||
|
||||
async def async_update(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user