Fix naming of device entities created by Fritz!Tools (#67076)

pull/67092/head
Michael 2022-02-23 00:39:19 +01:00 committed by GitHub
parent 7d4f5a68d6
commit 1274078f1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 15 deletions

View File

@ -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)