From 48f4b51a1d985b7429bd812991104bcb27f89828 Mon Sep 17 00:00:00 2001 From: G Johansson Date: Fri, 15 Jul 2022 11:07:39 +0200 Subject: [PATCH] Migrate DNSIP to new entity naming style (#75197) --- homeassistant/components/dnsip/sensor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/dnsip/sensor.py b/homeassistant/components/dnsip/sensor.py index a770afe388d..93bf73f1b9d 100644 --- a/homeassistant/components/dnsip/sensor.py +++ b/homeassistant/components/dnsip/sensor.py @@ -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: