Add device info to Withings (#99052)

This commit is contained in:
Joost Lekkerkerker 2023-08-27 16:06:08 +02:00 committed by GitHub
parent a73f214ead
commit 6e157fef18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,12 +38,13 @@ from homeassistant.helpers.config_entry_oauth2_flow import (
AbstractOAuth2Implementation,
OAuth2Session,
)
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity import Entity, EntityDescription
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from homeassistant.util import dt as dt_util
from . import const
from .const import Measurement
from .const import DOMAIN, Measurement
_LOGGER = logging.getLogger(const.LOG_NAMESPACE)
_RETRY_COEFFICIENT = 0.5
@ -561,6 +562,10 @@ class BaseWithingsSensor(Entity):
description, data_manager.user_id
)
self._state_data: Any | None = None
self._attr_device_info = DeviceInfo(
identifiers={(DOMAIN, str(data_manager.user_id))},
name=data_manager.profile,
)
@property
def available(self) -> bool: