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