From 1274078f1b875804833120e7039e00b2d94ddc20 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Wed, 23 Feb 2022 00:39:19 +0100 Subject: [PATCH] Fix naming of device entities created by Fritz!Tools (#67076) --- homeassistant/components/fritz/switch.py | 26 ++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/homeassistant/components/fritz/switch.py b/homeassistant/components/fritz/switch.py index 3b01ce618b8..730ffb7fc0d 100644 --- a/homeassistant/components/fritz/switch.py +++ b/homeassistant/components/fritz/switch.py @@ -479,6 +479,17 @@ class FritzBoxProfileSwitch(FritzDeviceBase, SwitchEntity): self._name = f"{device.hostname} Internet Access" self._attr_unique_id = f"{self._mac}_internet_access" self._attr_entity_category = EntityCategory.CONFIG + self._attr_device_info = DeviceInfo( + connections={(CONNECTION_NETWORK_MAC, self._mac)}, + default_manufacturer="AVM", + default_model="FRITZ!Box Tracked device", + default_name=device.hostname, + identifiers={(DOMAIN, self._mac)}, + via_device=( + DOMAIN, + avm_wrapper.unique_id, + ), + ) @property def is_on(self) -> bool | None: @@ -492,21 +503,6 @@ class FritzBoxProfileSwitch(FritzDeviceBase, SwitchEntity): return False return super().available - @property - def device_info(self) -> DeviceInfo: - """Return the device information.""" - return DeviceInfo( - connections={(CONNECTION_NETWORK_MAC, self._mac)}, - default_manufacturer="AVM", - default_model="FRITZ!Box Tracked device", - default_name=self.name, - identifiers={(DOMAIN, self._mac)}, - via_device=( - DOMAIN, - self._avm_wrapper.unique_id, - ), - ) - async def async_turn_on(self, **kwargs: Any) -> None: """Turn on switch.""" await self._async_handle_turn_on_off(turn_on=True)