From 7499f900e397199dbc5d86ef52a07a7eb46b8f01 Mon Sep 17 00:00:00 2001 From: cyr-ius Date: Sat, 14 Dec 2024 16:56:38 +0100 Subject: [PATCH] Move attributes to parent class --- custom_components/bbox/device_tracker.py | 3 --- custom_components/bbox/entity.py | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/custom_components/bbox/device_tracker.py b/custom_components/bbox/device_tracker.py index 761b731..e0afe3d 100644 --- a/custom_components/bbox/device_tracker.py +++ b/custom_components/bbox/device_tracker.py @@ -44,9 +44,6 @@ def __init__( """Initialize.""" super().__init__(coordinator, description, device) - self._attr_name = self._device_name - self._attr_unique_id = f"{self._device_key}_device_tracker" - @property def source_type(self) -> str: """Return the source type, eg gps or router, of the device.""" diff --git a/custom_components/bbox/entity.py b/custom_components/bbox/entity.py index 710dc07..8b140c8 100644 --- a/custom_components/bbox/entity.py +++ b/custom_components/bbox/entity.py @@ -59,6 +59,9 @@ def __init__( self._device_name = device["hostname"] else: self._device_name = device["macaddress"] + + self._attr_name = self._device_name + self._attr_unique_id = f"{self._device_key}_device_tracker" self._attr_device_info = { "name": self._device_name, "identifiers": {(DOMAIN, self._device_key)},