Replace dict with DeviceInfo (#49950)
* Replace dict with DeviceInfo * Clean up Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
ddd7e79ee9
commit
29d72714f3
70 changed files with 159 additions and 138 deletions
|
@ -2,7 +2,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from adguardhome import AdGuardHome, AdGuardHomeConnectionError, AdGuardHomeError
|
||||
import voluptuous as vol
|
||||
|
@ -33,7 +32,7 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -194,7 +193,7 @@ class AdGuardHomeDeviceEntity(AdGuardHomeEntity):
|
|||
"""Defines a AdGuard Home device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this AdGuard Home instance."""
|
||||
return {
|
||||
"identifiers": {
|
||||
|
|
|
@ -9,6 +9,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from .const import DATA_ASUSWRT, DOMAIN
|
||||
from .router import AsusWrtRouter
|
||||
|
@ -105,7 +106,7 @@ class AsusWrtDevice(ScannerEntity):
|
|||
return self._device.mac
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
data = {
|
||||
"connections": {(CONNECTION_NETWORK_MAC, self._device.mac)},
|
||||
|
|
|
@ -24,6 +24,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
@ -367,7 +368,7 @@ class AsusWrtRouter:
|
|||
return req_reload
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, "AsusWRT")},
|
||||
|
|
|
@ -9,6 +9,7 @@ from homeassistant.components.sensor import SensorEntity
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import DATA_GIGABYTES, DATA_RATE_MEGABITS_PER_SECOND
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -167,6 +168,6 @@ class AsusWrtSensor(CoordinatorEntity, SensorEntity):
|
|||
return {"hostname": self._router.host}
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return self._router.device_info
|
||||
|
|
|
@ -11,6 +11,7 @@ from homeassistant.components.water_heater import DOMAIN as WATER_HEATER
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -77,7 +78,7 @@ class AtagEntity(CoordinatorEntity):
|
|||
self._name = DOMAIN.title()
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return info for device registry."""
|
||||
device = self.coordinator.data.id
|
||||
version = self.coordinator.data.apiversion
|
||||
|
|
|
@ -11,6 +11,7 @@ from homeassistant.const import ATTR_ATTRIBUTION, ATTR_DEVICE_CLASS, CONF_ACCESS
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
@ -209,7 +210,7 @@ class AwairSensor(CoordinatorEntity, SensorEntity):
|
|||
return attrs
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Device information."""
|
||||
info = {
|
||||
"identifiers": {(DOMAIN, self._device.uuid)},
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from aioazuredevops.client import DevOpsClient
|
||||
import aiohttp
|
||||
|
@ -17,7 +16,7 @@ from homeassistant.components.azure_devops.const import (
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -103,7 +102,7 @@ class AzureDevOpsDeviceEntity(AzureDevOpsEntity):
|
|||
"""Defines a Azure DevOps device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this Azure DevOps instance."""
|
||||
return {
|
||||
"identifiers": {
|
||||
|
|
|
@ -20,7 +20,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.event import track_utc_time_change
|
||||
from homeassistant.util import slugify
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
@ -315,7 +315,7 @@ class BMWConnectedDriveBaseEntity(Entity):
|
|||
}
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return info for device registry."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._vehicle.vin)},
|
||||
|
|
|
@ -27,6 +27,7 @@ from homeassistant.const import (
|
|||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from .const import (
|
||||
|
@ -231,7 +232,7 @@ class BSBLanClimate(ClimateEntity):
|
|||
self._temperature_unit = state.current_temperature.unit
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this BSBLan device."""
|
||||
return {
|
||||
ATTR_IDENTIFIERS: {(DOMAIN, self._info.device_identification)},
|
||||
|
|
|
@ -27,6 +27,7 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -358,7 +359,7 @@ class ClimaCellEntity(CoordinatorEntity):
|
|||
return ATTRIBUTION
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device registry information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._config_entry.data[CONF_API_KEY])},
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
from typing import Any
|
||||
|
||||
from directv import DIRECTV, DIRECTVError
|
||||
|
||||
|
@ -12,7 +11,7 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import (
|
||||
ATTR_IDENTIFIERS,
|
||||
|
@ -72,7 +71,7 @@ class DIRECTVEntity(Entity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this DirecTV receiver."""
|
||||
return {
|
||||
ATTR_IDENTIFIERS: {(DOMAIN, self._device_id)},
|
||||
|
|
|
@ -7,7 +7,6 @@ from contextlib import suppress
|
|||
from datetime import timedelta
|
||||
from functools import partial
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from dsmr_parser import obis_references as obis_ref
|
||||
from dsmr_parser.clients.protocol import create_dsmr_reader, create_tcp_dsmr_reader
|
||||
|
@ -24,6 +23,7 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import CoreState, HomeAssistant, callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from .const import (
|
||||
|
@ -362,7 +362,7 @@ class DSMREntity(SensorEntity):
|
|||
return self._unique_id
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._device_serial)},
|
||||
|
|
|
@ -7,7 +7,7 @@ from homeassistant.components.dynalite.bridge import DynaliteBridge
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import DOMAIN, LOGGER
|
||||
|
||||
|
@ -60,7 +60,7 @@ class DynaliteBase(Entity):
|
|||
return self._device.available
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Device info for this entity."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._device.unique_id)},
|
||||
|
|
|
@ -5,6 +5,7 @@ from aioemonitor.monitor import EmonitorChannel
|
|||
from homeassistant.components.sensor import DEVICE_CLASS_POWER, SensorEntity
|
||||
from homeassistant.const import POWER_WATT
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.typing import StateType
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
|
@ -98,7 +99,7 @@ class EmonitorPowerSensor(CoordinatorEntity, SensorEntity):
|
|||
return self.coordinator.data.network.mac_address
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return info about the emonitor device."""
|
||||
return {
|
||||
"name": name_short_mac(self.mac_address[-6:]),
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from .board import FirmataPinType
|
||||
from .const import DOMAIN, FIRMATA_MANUFACTURER
|
||||
|
@ -16,7 +17,7 @@ class FirmataEntity:
|
|||
self._api = api
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device info."""
|
||||
return {
|
||||
"connections": {},
|
||||
|
|
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||
from typing import Any
|
||||
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import DOMAIN as FLO_DOMAIN
|
||||
from .device import FloDeviceDataUpdateCoordinator
|
||||
|
@ -37,7 +37,7 @@ class FloEntity(Entity):
|
|||
return self._unique_id
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return a device description for device registry."""
|
||||
return {
|
||||
"identifiers": {(FLO_DOMAIN, self._device.id)},
|
||||
|
|
|
@ -10,6 +10,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from .const import DEFAULT_DEVICE_NAME, DEVICE_ICONS, DOMAIN
|
||||
from .router import FreeboxRouter
|
||||
|
@ -111,7 +112,7 @@ class FreeboxDevice(ScannerEntity):
|
|||
return self._attrs
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"connections": {(CONNECTION_NETWORK_MAC, self._mac)},
|
||||
|
|
|
@ -17,6 +17,7 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.util import slugify
|
||||
|
||||
|
@ -180,7 +181,7 @@ class FreeboxRouter:
|
|||
self._api = None
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"connections": {(CONNECTION_NETWORK_MAC, self.mac)},
|
||||
|
|
|
@ -9,6 +9,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import DATA_RATE_KILOBYTES_PER_SECOND
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import (
|
||||
|
@ -130,7 +131,7 @@ class FreeboxSensor(SensorEntity):
|
|||
return self._device_class
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return self._router.device_info
|
||||
|
||||
|
@ -208,7 +209,7 @@ class FreeboxDiskSensor(FreeboxSensor):
|
|||
self._unique_id = f"{self._router.mac} {sensor_type} {self._disk['id']} {self._partition['id']}"
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._disk["id"])},
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from freebox_api.exceptions import InsufficientPermissionsError
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from .const import DOMAIN
|
||||
from .router import FreeboxRouter
|
||||
|
@ -50,7 +50,7 @@ class FreeboxWifiSwitch(SwitchEntity):
|
|||
return self._state
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return self._router.device_info
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -18,6 +17,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .common import FritzBoxTools
|
||||
|
@ -154,7 +154,7 @@ class FritzBoxTracker(ScannerEntity):
|
|||
return SOURCE_TYPE_ROUTER
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"connections": {(CONNECTION_NETWORK_MAC, self._mac)},
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from garminconnect import (
|
||||
GarminConnectAuthenticationError,
|
||||
|
@ -14,6 +13,7 @@ from homeassistant.components.sensor import SensorEntity
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from .alarm_util import calculate_next_active_alarms
|
||||
from .const import ATTRIBUTION, DOMAIN, GARMIN_ENTITY_LIST
|
||||
|
@ -138,7 +138,7 @@ class GarminConnectSensor(SensorEntity):
|
|||
return attributes
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._unique_id)},
|
||||
|
|
|
@ -9,6 +9,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import ATTR_ATTRIBUTION, CONF_IP_ADDRESS, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -232,7 +233,7 @@ class GuardianEntity(CoordinatorEntity):
|
|||
return self._device_class
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device registry information for this entity."""
|
||||
return self._device_info
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from __future__ import annotations
|
|||
from typing import Any
|
||||
|
||||
from homeassistant.const import ATTR_NAME
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from . import DOMAIN, HassioDataUpdateCoordinator
|
||||
|
@ -49,7 +50,7 @@ class HassioAddonEntity(CoordinatorEntity):
|
|||
return f"{self.addon_slug}_{self.attribute_name}"
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device specific attributes."""
|
||||
return {"identifiers": {(DOMAIN, self.addon_slug)}}
|
||||
|
||||
|
@ -90,6 +91,6 @@ class HassioOSEntity(CoordinatorEntity):
|
|||
return f"home_assistant_os_{self.attribute_name}"
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device specific attributes."""
|
||||
return {"identifiers": {(DOMAIN, "OS")}}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from homematicip.functionalHomes import SecurityAndAlarmHome
|
||||
|
||||
|
@ -19,6 +18,7 @@ from homeassistant.const import (
|
|||
STATE_ALARM_TRIGGERED,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -45,7 +45,7 @@ class HomematicipAlarmControlPanelEntity(AlarmControlPanelEntity):
|
|||
_LOGGER.info("Setting up %s", self.name)
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device specific attributes."""
|
||||
return {
|
||||
"identifiers": {(HMIPC_DOMAIN, f"ACP {self._home.id}")},
|
||||
|
|
|
@ -45,6 +45,7 @@ from homeassistant.components.binary_sensor import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HomematicipGenericEntity
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -168,7 +169,7 @@ class HomematicipCloudConnectionSensor(HomematicipGenericEntity, BinarySensorEnt
|
|||
return name if not self._home.name else f"{self._home.name} {name}"
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device specific attributes."""
|
||||
# Adds a sensor to the existing HAP device
|
||||
return {
|
||||
|
|
|
@ -27,6 +27,7 @@ from homeassistant.components.climate.const import (
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from . import DOMAIN as HMIPC_DOMAIN, HomematicipGenericEntity
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -73,7 +74,7 @@ class HomematicipHeatingGroup(HomematicipGenericEntity, ClimateEntity):
|
|||
self._simple_heating = self._first_radiator_thermostat
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device specific attributes."""
|
||||
return {
|
||||
"identifiers": {(HMIPC_DOMAIN, self._device.id)},
|
||||
|
|
|
@ -10,7 +10,7 @@ from homematicip.aio.group import AsyncGroup
|
|||
from homeassistant.const import ATTR_ID
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import DOMAIN as HMIPC_DOMAIN
|
||||
from .hap import HomematicipHAP
|
||||
|
@ -92,7 +92,7 @@ class HomematicipGenericEntity(Entity):
|
|||
_LOGGER.info("Setting up %s (%s)", self.name, self._device.modelType)
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device specific attributes."""
|
||||
# Only physical devices should be HA devices.
|
||||
if isinstance(self._device, AsyncDevice):
|
||||
|
|
|
@ -4,7 +4,6 @@ from __future__ import annotations
|
|||
import asyncio
|
||||
from functools import wraps
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import aiohttp.client_exceptions
|
||||
from iaqualink import (
|
||||
|
@ -35,7 +34,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
async_dispatcher_connect,
|
||||
async_dispatcher_send,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
|
@ -234,7 +233,7 @@ class AqualinkEntity(Entity):
|
|||
return self.dev.system.online
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device info."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self.unique_id)},
|
||||
|
|
|
@ -8,6 +8,7 @@ from homeassistant.components.device_tracker.config_entry import TrackerEntity
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from .account import IcloudAccount, IcloudDevice
|
||||
from .const import (
|
||||
|
@ -112,7 +113,7 @@ class IcloudTrackerEntity(TrackerEntity):
|
|||
return self._device.extra_state_attributes
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._device.unique_id)},
|
||||
|
|
|
@ -8,6 +8,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.icon import icon_for_battery_level
|
||||
|
||||
from .account import IcloudAccount, IcloudDevice
|
||||
|
@ -97,7 +98,7 @@ class IcloudDeviceBatterySensor(SensorEntity):
|
|||
return self._device.extra_state_attributes
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._device.unique_id)},
|
||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from pyipp import IPP, IPPError, Printer as IPPPrinter
|
||||
|
||||
|
@ -18,6 +17,7 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -145,7 +145,7 @@ class IPPEntity(CoordinatorEntity):
|
|||
return self._enabled_default
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this IPP device."""
|
||||
if self._device_id is None:
|
||||
return None
|
||||
|
|
|
@ -9,6 +9,7 @@ from homeassistant.components.sensor import SensorEntity
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_DEVICE_CLASS, ATTR_ICON, ATTR_UNIT_OF_MEASUREMENT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import (
|
||||
|
@ -113,7 +114,7 @@ class PlenticoreDataSensor(CoordinatorEntity, SensorEntity):
|
|||
sensor_name: str,
|
||||
sensor_data: dict[str, Any],
|
||||
formatter: Callable[[str], Any],
|
||||
device_info: dict[str, Any],
|
||||
device_info: DeviceInfo,
|
||||
):
|
||||
"""Create a new Sensor Entity for Plenticore process data."""
|
||||
super().__init__(coordinator)
|
||||
|
@ -149,7 +150,7 @@ class PlenticoreDataSensor(CoordinatorEntity, SensorEntity):
|
|||
await super().async_will_remove_from_hass()
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device info."""
|
||||
return self._device_info
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ from pylitterbot import Robot
|
|||
from pylitterbot.exceptions import InvalidCommandException
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
@ -43,7 +44,7 @@ class LitterRobotEntity(CoordinatorEntity):
|
|||
return f"{self.robot.serial}-{self.entity_type}"
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information for a Litter-Robot."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self.robot.serial)},
|
||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from aiohttp.client_exceptions import ClientResponseError
|
||||
from aiolyric import Lyric
|
||||
|
@ -23,6 +22,7 @@ from homeassistant.helpers import (
|
|||
config_validation as cv,
|
||||
device_registry as dr,
|
||||
)
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -183,7 +183,7 @@ class LyricDeviceEntity(LyricEntity):
|
|||
"""Defines a Honeywell Lyric device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this Honeywell Lyric instance."""
|
||||
return {
|
||||
"connections": {(dr.CONNECTION_NETWORK_MAC, self._mac_id)},
|
||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from mcstatus.server import MinecraftServer as MCStatus
|
||||
|
||||
|
@ -14,7 +13,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
async_dispatcher_connect,
|
||||
async_dispatcher_send,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
|
@ -247,7 +246,7 @@ class MinecraftServerEntity(Entity):
|
|||
return self._unique_id
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information."""
|
||||
return self._device_info
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ from homeassistant.const import (
|
|||
HTTP_DIGEST_AUTHENTICATION,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
|
@ -203,6 +204,6 @@ class MotionEyeMjpegCamera(MjpegCamera, CoordinatorEntity):
|
|||
return self._motion_detection_enabled
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {"identifiers": {self._device_identifier}}
|
||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
|
||||
from functools import partial
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from mysensors import BaseAsyncGateway, Sensor
|
||||
from mysensors.sensor import ChildSensor
|
||||
|
@ -11,7 +10,7 @@ from mysensors.sensor import ChildSensor
|
|||
from homeassistant.const import ATTR_BATTERY_LEVEL, STATE_OFF, STATE_ON
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import (
|
||||
CHILD_CALLBACK,
|
||||
|
@ -109,7 +108,7 @@ class MySensorsDevice:
|
|||
return f"{self.gateway_id}-{self.node_id}-{self.child_id}-{self.value_type}"
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any] | None:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return a dict that allows home assistant to puzzle all entities belonging to a node together."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, f"{self.gateway_id}-{self.node_id}")},
|
||||
|
|
|
@ -14,6 +14,7 @@ from homeassistant.helpers import (
|
|||
config_validation as cv,
|
||||
device_registry as dr,
|
||||
)
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -175,7 +176,7 @@ class NotionEntity(CoordinatorEntity):
|
|||
return self._attrs
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device registry information for this entity."""
|
||||
bridge = self.coordinator.data["bridges"].get(self._bridge_id, {})
|
||||
sensor = self.coordinator.data["sensors"][self._sensor_id]
|
||||
|
|
|
@ -6,7 +6,7 @@ from typing import Any
|
|||
|
||||
from pyownet import protocol
|
||||
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import (
|
||||
SENSOR_TYPE_COUNT,
|
||||
|
@ -65,7 +65,7 @@ class OneWireBaseEntity(Entity):
|
|||
return self._unique_id
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any] | None:
|
||||
def device_info(self) -> DeviceInfo | None:
|
||||
"""Return device specific attributes."""
|
||||
return self._device_info
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import aiohttp
|
||||
import async_timeout
|
||||
|
@ -14,6 +13,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
|
@ -136,7 +136,7 @@ class OVOEnergyDeviceEntity(OVOEnergyEntity):
|
|||
"""Defines a OVO Energy device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this OVO Energy instance."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._client.account_id)},
|
||||
|
|
|
@ -4,7 +4,6 @@ from __future__ import annotations
|
|||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import async_timeout
|
||||
from plugwise.exceptions import (
|
||||
|
@ -26,6 +25,7 @@ from homeassistant.core import HomeAssistant, callback
|
|||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -190,7 +190,7 @@ class SmileGateway(CoordinatorEntity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
device_information = {
|
||||
"identifiers": {(DOMAIN, self._dev_id)},
|
||||
|
|
|
@ -18,6 +18,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import aiohttp_client, config_validation as cv
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -201,7 +202,7 @@ class RainMachineEntity(CoordinatorEntity):
|
|||
return self._device_class
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device registry information for this entity."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._controller.mac)},
|
||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from rokuecp import Roku, RokuConnectionError, RokuError
|
||||
from rokuecp.models import Device
|
||||
|
@ -15,6 +14,7 @@ from homeassistant.const import ATTR_NAME, CONF_HOST
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -133,7 +133,7 @@ class RokuEntity(CoordinatorEntity):
|
|||
return self._name
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this Roku device."""
|
||||
if self._device_id is None:
|
||||
return None
|
||||
|
|
|
@ -7,6 +7,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import entity_registry
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import (
|
||||
|
@ -117,7 +118,7 @@ class RuckusUnleashedDevice(CoordinatorEntity, ScannerEntity):
|
|||
return SOURCE_TYPE_ROUTER
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict | None:
|
||||
def device_info(self) -> DeviceInfo | None:
|
||||
"""Return the device information."""
|
||||
if self.is_connected:
|
||||
return {
|
||||
|
|
|
@ -23,6 +23,7 @@ from homeassistant.components.vacuum import (
|
|||
SUPPORT_STOP,
|
||||
StateVacuumEntity,
|
||||
)
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN, SHARK
|
||||
|
@ -118,7 +119,7 @@ class SharkVacuumEntity(CoordinatorEntity, StateVacuumEntity):
|
|||
return self.sharkiq.oem_model_number
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Device info dictionary."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self.serial_number)},
|
||||
|
|
|
@ -20,6 +20,7 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.typing import StateType
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
|
@ -182,7 +183,7 @@ class SMAsensor(CoordinatorEntity, SensorEntity):
|
|||
)
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._config_entry_unique_id)},
|
||||
|
|
|
@ -3,6 +3,7 @@ import logging
|
|||
|
||||
import smarttub
|
||||
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -36,7 +37,7 @@ class SmartTubEntity(CoordinatorEntity):
|
|||
return f"{self.spa.id}-{self._entity_name}"
|
||||
|
||||
@property
|
||||
def device_info(self) -> str:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device info."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self.spa.id)},
|
||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from sonarr import Sonarr, SonarrAccessRestricted, SonarrError
|
||||
|
||||
|
@ -19,7 +18,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import (
|
||||
ATTR_IDENTIFIERS,
|
||||
|
@ -139,7 +138,7 @@ class SonarrEntity(Entity):
|
|||
return self._enabled_default
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo | None:
|
||||
"""Return device information about the application."""
|
||||
if self._device_id is None:
|
||||
return None
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from pysonos.core import SoCo
|
||||
|
||||
|
@ -11,7 +10,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
async_dispatcher_connect,
|
||||
async_dispatcher_send,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import (
|
||||
DOMAIN,
|
||||
|
@ -56,7 +55,7 @@ class SonosEntity(Entity):
|
|||
return self.speaker.soco
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return information about the device."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self.soco.uid)},
|
||||
|
|
|
@ -5,7 +5,6 @@ from asyncio import run_coroutine_threadsafe
|
|||
import datetime as dt
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
from spotipy import Spotify, SpotifyException
|
||||
|
@ -54,6 +53,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.config_entry_oauth2_flow import OAuth2Session
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.util.dt import utc_from_timestamp
|
||||
|
||||
|
@ -272,7 +272,7 @@ class SpotifyMediaPlayer(MediaPlayerEntity):
|
|||
return self._id
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
if self._me is not None:
|
||||
model = self._me["product"]
|
||||
|
|
|
@ -40,6 +40,7 @@ from homeassistant.core import HomeAssistant, ServiceCall, callback
|
|||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import entity_registry
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -620,7 +621,7 @@ class SynologyDSMBaseEntity(CoordinatorEntity):
|
|||
return {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._api.information.serial)},
|
||||
|
@ -690,7 +691,7 @@ class SynologyDSMDeviceEntity(SynologyDSMBaseEntity):
|
|||
return bool(self._api.storage)
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._api.information.serial, self._device_id)},
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from synology_dsm.api.surveillance_station import SynoSurveillanceStation
|
||||
from synology_dsm.exceptions import (
|
||||
|
@ -13,6 +12,7 @@ from synology_dsm.exceptions import (
|
|||
from homeassistant.components.camera import SUPPORT_STREAM, Camera
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from . import SynoApi, SynologyDSMBaseEntity
|
||||
|
@ -81,7 +81,7 @@ class SynoDSMCamera(SynologyDSMBaseEntity, Camera):
|
|||
return self.coordinator.data["cameras"][self._camera_id]
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"identifiers": {
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from synology_dsm.api.surveillance_station import SynoSurveillanceStation
|
||||
|
||||
from homeassistant.components.switch import ToggleEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from . import SynoApi, SynologyDSMBaseEntity
|
||||
|
@ -97,7 +97,7 @@ class SynoDSMSurveillanceHomeModeToggle(SynologyDSMBaseEntity, ToggleEntity):
|
|||
return bool(self._api.surveillance_station)
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device information."""
|
||||
return {
|
||||
"identifiers": {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
"""DataUpdate Coordinator, and base Entity and Device models for Toon."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN
|
||||
|
@ -47,7 +46,7 @@ class ToonDisplayDeviceEntity(ToonEntity):
|
|||
"""Defines a Toon display device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this thermostat."""
|
||||
agreement = self.coordinator.data.agreement
|
||||
model = agreement.display_hardware_version.rpartition("/")[0]
|
||||
|
@ -65,7 +64,7 @@ class ToonElectricityMeterDeviceEntity(ToonEntity):
|
|||
"""Defines a Electricity Meter device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
agreement_id = self.coordinator.data.agreement.agreement_id
|
||||
return {
|
||||
|
@ -79,7 +78,7 @@ class ToonGasMeterDeviceEntity(ToonEntity):
|
|||
"""Defines a Gas Meter device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
agreement_id = self.coordinator.data.agreement.agreement_id
|
||||
return {
|
||||
|
@ -93,7 +92,7 @@ class ToonWaterMeterDeviceEntity(ToonEntity):
|
|||
"""Defines a Water Meter device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
agreement_id = self.coordinator.data.agreement.agreement_id
|
||||
return {
|
||||
|
@ -107,7 +106,7 @@ class ToonSolarDeviceEntity(ToonEntity):
|
|||
"""Defines a Solar Device device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
agreement_id = self.coordinator.data.agreement.agreement_id
|
||||
return {
|
||||
|
@ -121,7 +120,7 @@ class ToonBoilerModuleDeviceEntity(ToonEntity):
|
|||
"""Defines a Boiler Module device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
agreement_id = self.coordinator.data.agreement.agreement_id
|
||||
return {
|
||||
|
@ -136,7 +135,7 @@ class ToonBoilerDeviceEntity(ToonEntity):
|
|||
"""Defines a Boiler device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
agreement_id = self.coordinator.data.agreement.agreement_id
|
||||
return {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Twente Milieu sensors."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable
|
||||
from typing import Callable
|
||||
|
||||
from twentemilieu import (
|
||||
WASTE_TYPE_NON_RECYCLABLE,
|
||||
|
@ -18,7 +18,7 @@ from homeassistant.const import CONF_ID
|
|||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import PlatformNotReady
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import DATA_UPDATE, DOMAIN
|
||||
|
||||
|
@ -147,7 +147,7 @@ class TwenteMilieuSensor(SensorEntity):
|
|||
self._state = next_pickup.date().isoformat()
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about Twente Milieu."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._unique_id)},
|
||||
|
|
|
@ -18,6 +18,7 @@ from aiounifi.events import (
|
|||
from homeassistant.components.switch import DOMAIN, SwitchEntity
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_registry import async_entries_for_config_entry
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
|
||||
|
@ -362,7 +363,7 @@ class UniFiDPIRestrictionSwitch(UniFiBase, SwitchEntity):
|
|||
await self.remove_item({self.key})
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return a service description for device registry."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, f"unifi_controller_{self._item.site_id}")},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Base class for UniFi clients."""
|
||||
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
|
||||
from .unifi_entity_base import UniFiBase
|
||||
|
||||
|
@ -44,7 +45,7 @@ class UniFiClient(UniFiBase):
|
|||
return self.controller.available
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return a client description for device registry."""
|
||||
return {
|
||||
"connections": {(CONNECTION_NETWORK_MAC, self.client.mac)},
|
||||
|
|
|
@ -9,6 +9,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import DATA_BYTES, DATA_RATE_KIBIBYTES_PER_SECOND
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
|
@ -165,7 +166,7 @@ class UpnpSensor(CoordinatorEntity, SensorEntity):
|
|||
return self._sensor_type["unit"]
|
||||
|
||||
@property
|
||||
def device_info(self) -> Mapping[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Get device info."""
|
||||
return {
|
||||
"connections": {(dr.CONNECTION_UPNP, self._device.udn)},
|
||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
from typing import Callable
|
||||
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
FORMAT_NUMBER,
|
||||
|
@ -15,7 +15,7 @@ from homeassistant.components.alarm_control_panel.const import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import ALARM_STATE_TO_HA, CONF_GIID, DOMAIN, LOGGER
|
||||
|
@ -50,7 +50,7 @@ class VerisureAlarm(CoordinatorEntity, AlarmControlPanelEntity):
|
|||
return self.coordinator.entry.data[CONF_GIID]
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
return {
|
||||
"name": "Verisure Alarm",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
from typing import Callable
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASS_CONNECTIVITY,
|
||||
|
@ -11,7 +11,7 @@ from homeassistant.components.binary_sensor import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import CONF_GIID, DOMAIN
|
||||
|
@ -59,7 +59,7 @@ class VerisureDoorWindowSensor(CoordinatorEntity, BinarySensorEntity):
|
|||
return f"{self.serial_number}_door_window"
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
area = self.coordinator.data["door_window"][self.serial_number]["area"]
|
||||
return {
|
||||
|
@ -108,7 +108,7 @@ class VerisureEthernetStatus(CoordinatorEntity, BinarySensorEntity):
|
|||
return f"{self.coordinator.entry.data[CONF_GIID]}_ethernet"
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
return {
|
||||
"name": "Verisure Alarm",
|
||||
|
|
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||
from collections.abc import Iterable
|
||||
import errno
|
||||
import os
|
||||
from typing import Any, Callable
|
||||
from typing import Callable
|
||||
|
||||
from verisure import Error as VerisureError
|
||||
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.components.camera import Camera
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.entity_platform import current_platform
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
|
@ -73,7 +73,7 @@ class VerisureSmartcam(CoordinatorEntity, Camera):
|
|||
return self.serial_number
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
area = self.coordinator.data["cameras"][self.serial_number]["area"]
|
||||
return {
|
||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
|
||||
import asyncio
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
from typing import Callable
|
||||
|
||||
from verisure import Error as VerisureError
|
||||
|
||||
|
@ -11,7 +11,7 @@ from homeassistant.components.lock import LockEntity
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_CODE, STATE_LOCKED, STATE_UNLOCKED
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.entity_platform import current_platform
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
|
@ -81,7 +81,7 @@ class VerisureDoorlock(CoordinatorEntity, LockEntity):
|
|||
return self.serial_number
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
area = self.coordinator.data["locks"][self.serial_number]["area"]
|
||||
return {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Callable
|
||||
from typing import Callable
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
DEVICE_CLASS_HUMIDITY,
|
||||
|
@ -12,7 +12,7 @@ from homeassistant.components.sensor import (
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import CONF_GIID, DEVICE_TYPE_NAME, DOMAIN
|
||||
|
@ -76,7 +76,7 @@ class VerisureThermometer(CoordinatorEntity, SensorEntity):
|
|||
return DEVICE_CLASS_TEMPERATURE
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
device_type = self.coordinator.data["climate"][self.serial_number].get(
|
||||
"deviceType"
|
||||
|
@ -140,7 +140,7 @@ class VerisureHygrometer(CoordinatorEntity, SensorEntity):
|
|||
return DEVICE_CLASS_HUMIDITY
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
device_type = self.coordinator.data["climate"][self.serial_number].get(
|
||||
"deviceType"
|
||||
|
@ -199,7 +199,7 @@ class VerisureMouseDetection(CoordinatorEntity, SensorEntity):
|
|||
return f"{self.serial_number}_mice"
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
area = self.coordinator.data["mice"][self.serial_number]["area"]
|
||||
return {
|
||||
|
|
|
@ -3,12 +3,12 @@ from __future__ import annotations
|
|||
|
||||
from collections.abc import Iterable
|
||||
from time import monotonic
|
||||
from typing import Any, Callable
|
||||
from typing import Callable
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import CONF_GIID, DOMAIN
|
||||
|
@ -53,7 +53,7 @@ class VerisureSmartplug(CoordinatorEntity, SwitchEntity):
|
|||
return self.serial_number
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this entity."""
|
||||
area = self.coordinator.data["smart_plugs"][self.serial_number]["area"]
|
||||
return {
|
||||
|
|
|
@ -33,7 +33,7 @@ from homeassistant.helpers.dispatcher import (
|
|||
async_dispatcher_connect,
|
||||
async_dispatcher_send,
|
||||
)
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
from .const import (
|
||||
|
@ -423,7 +423,7 @@ class VizioDevice(MediaPlayerEntity):
|
|||
return self._config_entry.unique_id
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device registry information."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._config_entry.unique_id)},
|
||||
|
|
|
@ -5,13 +5,12 @@ import asyncio
|
|||
from collections.abc import Generator
|
||||
import contextlib
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import async_timeout
|
||||
from pywemo import WeMoDevice
|
||||
from pywemo.exceptions import ActionException
|
||||
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
|
||||
from .const import DOMAIN as WEMO_DOMAIN
|
||||
|
||||
|
@ -127,7 +126,7 @@ class WemoSubscriptionEntity(WemoEntity):
|
|||
return self.wemo.serialnumber
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device info."""
|
||||
return {
|
||||
"name": self.name,
|
||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from wled import WLED, Device as WLEDDevice, WLEDConnectionError, WLEDError
|
||||
|
||||
|
@ -14,6 +13,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import ATTR_NAME, CONF_HOST
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.entity import DeviceInfo
|
||||
from homeassistant.helpers.update_coordinator import (
|
||||
CoordinatorEntity,
|
||||
DataUpdateCoordinator,
|
||||
|
@ -165,7 +165,7 @@ class WLEDDeviceEntity(WLEDEntity):
|
|||
"""Defines a WLED device entity."""
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return device information about this WLED device."""
|
||||
return {
|
||||
ATTR_IDENTIFIERS: {(DOMAIN, self.coordinator.data.info.mac_address)},
|
||||
|
|
|
@ -19,7 +19,7 @@ from homeassistant.const import (
|
|||
from homeassistant.core import HomeAssistant, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.event import async_track_time_interval
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -553,7 +553,7 @@ class YeelightEntity(Entity):
|
|||
return self._unique_id
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict:
|
||||
def device_info(self) -> DeviceInfo:
|
||||
"""Return the device info."""
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self._unique_id)},
|
||||
|
|
|
@ -83,7 +83,7 @@ class BaseZhaEntity(LogMixin, entity.Entity):
|
|||
return self._should_poll
|
||||
|
||||
@property
|
||||
def device_info(self) -> dict[str, Any]:
|
||||
def device_info(self) -> entity.DeviceInfo:
|
||||
"""Return a device description for device registry."""
|
||||
zha_device_info = self._zha_device.device_info
|
||||
ieee = zha_device_info["ieee"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue