From 4a8e9df026095bb25b5d0d0b05754f96bd31b6ce Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Sat, 23 Oct 2021 09:35:33 -0400 Subject: [PATCH] Use DeviceInfo Class H (#58276) --- homeassistant/components/harmony/data.py | 17 +++++----- homeassistant/components/hassio/entity.py | 6 ++-- homeassistant/components/heos/media_player.py | 14 ++++----- .../components/hive/binary_sensor.py | 4 +-- homeassistant/components/hive/climate.py | 4 +-- homeassistant/components/hive/light.py | 4 +-- homeassistant/components/hive/sensor.py | 4 +-- homeassistant/components/hive/switch.py | 4 +-- homeassistant/components/hive/water_heater.py | 4 +-- .../components/home_connect/entity.py | 16 +++++----- .../components/home_plus_control/switch.py | 17 +++++----- .../components/homekit_controller/__init__.py | 2 +- .../homematicip_cloud/alarm_control_panel.py | 2 +- .../homematicip_cloud/binary_sensor.py | 6 ++-- .../components/homematicip_cloud/climate.py | 2 +- .../homematicip_cloud/generic_entity.py | 2 +- .../components/huawei_lte/__init__.py | 8 ++--- homeassistant/components/hue/light.py | 31 ++++++++++--------- homeassistant/components/hue/sensor_device.py | 2 +- .../hunterdouglas_powerview/entity.py | 6 ++-- .../hvv_departures/binary_sensor.py | 11 ++++--- .../components/hvv_departures/sensor.py | 11 ++++--- homeassistant/components/hyperion/camera.py | 12 +++---- homeassistant/components/hyperion/light.py | 12 +++---- homeassistant/components/hyperion/switch.py | 12 +++---- 25 files changed, 110 insertions(+), 103 deletions(-) diff --git a/homeassistant/components/harmony/data.py b/homeassistant/components/harmony/data.py index 78377265c07..706e06e881e 100644 --- a/homeassistant/components/harmony/data.py +++ b/homeassistant/components/harmony/data.py @@ -10,6 +10,7 @@ import aioharmony.exceptions as aioexc from aioharmony.harmonyapi import HarmonyAPI as HarmonyClient from homeassistant.exceptions import ConfigEntryNotReady +from homeassistant.helpers.entity import DeviceInfo from .const import ACTIVITY_POWER_OFF from .subscriber import HarmonySubscriberMixin @@ -82,20 +83,20 @@ class HarmonyData(HarmonySubscriberMixin): """Return the current activity tuple.""" return self._client.current_activity - def device_info(self, domain: str): + def device_info(self, domain: str) -> DeviceInfo: """Return hub device info.""" model = "Harmony Hub" if "ethernetStatus" in self._client.hub_config.info: model = "Harmony Hub Pro 2400" - return { - "identifiers": {(domain, self.unique_id)}, - "manufacturer": "Logitech", - "sw_version": self._client.hub_config.info.get( + return DeviceInfo( + identifiers={(domain, self.unique_id)}, + manufacturer="Logitech", + model=model, + name=self.name, + sw_version=self._client.hub_config.info.get( "hubSwVersion", self._client.fw_version ), - "name": self.name, - "model": model, - } + ) async def connect(self) -> bool: """Connect to the Harmony Hub.""" diff --git a/homeassistant/components/hassio/entity.py b/homeassistant/components/hassio/entity.py index 4a342e9965f..1fd2926fe56 100644 --- a/homeassistant/components/hassio/entity.py +++ b/homeassistant/components/hassio/entity.py @@ -4,7 +4,7 @@ from __future__ import annotations from typing import Any from homeassistant.const import ATTR_NAME -from homeassistant.helpers.entity import EntityDescription +from homeassistant.helpers.entity import DeviceInfo, EntityDescription from homeassistant.helpers.update_coordinator import CoordinatorEntity from . import DOMAIN, HassioDataUpdateCoordinator @@ -26,7 +26,7 @@ class HassioAddonEntity(CoordinatorEntity): self._addon_slug = addon[ATTR_SLUG] self._attr_name = f"{addon[ATTR_NAME]}: {entity_description.name}" self._attr_unique_id = f"{addon[ATTR_SLUG]}_{entity_description.key}" - self._attr_device_info = {"identifiers": {(DOMAIN, addon[ATTR_SLUG])}} + self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, addon[ATTR_SLUG])}) class HassioOSEntity(CoordinatorEntity): @@ -42,4 +42,4 @@ class HassioOSEntity(CoordinatorEntity): self.entity_description = entity_description self._attr_name = f"Home Assistant Operating System: {entity_description.name}" self._attr_unique_id = f"home_assistant_os_{entity_description.key}" - self._attr_device_info = {"identifiers": {(DOMAIN, "OS")}} + self._attr_device_info = DeviceInfo(identifiers={(DOMAIN, "OS")}) diff --git a/homeassistant/components/heos/media_player.py b/homeassistant/components/heos/media_player.py index 46a751983e9..a562d8e3d7a 100644 --- a/homeassistant/components/heos/media_player.py +++ b/homeassistant/components/heos/media_player.py @@ -255,13 +255,13 @@ class HeosMediaPlayer(MediaPlayerEntity): @property def device_info(self) -> DeviceInfo: """Get attributes about the device.""" - return { - "identifiers": {(HEOS_DOMAIN, self._player.player_id)}, - "name": self._player.name, - "model": self._player.model, - "manufacturer": "HEOS", - "sw_version": self._player.version, - } + return DeviceInfo( + identifiers={(HEOS_DOMAIN, self._player.player_id)}, + manufacturer="HEOS", + model=self._player.model, + name=self._player.name, + sw_version=self._player.version, + ) @property def extra_state_attributes(self) -> dict: diff --git a/homeassistant/components/hive/binary_sensor.py b/homeassistant/components/hive/binary_sensor.py index 71a2e787aec..cd1bef406d2 100644 --- a/homeassistant/components/hive/binary_sensor.py +++ b/homeassistant/components/hive/binary_sensor.py @@ -51,9 +51,9 @@ class HiveBinarySensorEntity(HiveEntity, BinarySensorEntity): """Return device information.""" return DeviceInfo( identifiers={(DOMAIN, self.device["device_id"])}, - name=self.device["device_name"], - model=self.device["deviceData"]["model"], manufacturer=self.device["deviceData"]["manufacturer"], + model=self.device["deviceData"]["model"], + name=self.device["device_name"], sw_version=self.device["deviceData"]["version"], via_device=(DOMAIN, self.device["parentDevice"]), ) diff --git a/homeassistant/components/hive/climate.py b/homeassistant/components/hive/climate.py index 930a6698518..0b038bbde0d 100644 --- a/homeassistant/components/hive/climate.py +++ b/homeassistant/components/hive/climate.py @@ -122,9 +122,9 @@ class HiveClimateEntity(HiveEntity, ClimateEntity): """Return device information.""" return DeviceInfo( identifiers={(DOMAIN, self.device["device_id"])}, - name=self.device["device_name"], - model=self.device["deviceData"]["model"], manufacturer=self.device["deviceData"]["manufacturer"], + model=self.device["deviceData"]["model"], + name=self.device["device_name"], sw_version=self.device["deviceData"]["version"], via_device=(DOMAIN, self.device["parentDevice"]), ) diff --git a/homeassistant/components/hive/light.py b/homeassistant/components/hive/light.py index 37158da7b58..f9d235d625f 100644 --- a/homeassistant/components/hive/light.py +++ b/homeassistant/components/hive/light.py @@ -45,9 +45,9 @@ class HiveDeviceLight(HiveEntity, LightEntity): """Return device information.""" return DeviceInfo( identifiers={(DOMAIN, self.device["device_id"])}, - name=self.device["device_name"], - model=self.device["deviceData"]["model"], manufacturer=self.device["deviceData"]["manufacturer"], + model=self.device["deviceData"]["model"], + name=self.device["device_name"], sw_version=self.device["deviceData"]["version"], via_device=(DOMAIN, self.device["parentDevice"]), ) diff --git a/homeassistant/components/hive/sensor.py b/homeassistant/components/hive/sensor.py index abb45d04dec..bca144cd59c 100644 --- a/homeassistant/components/hive/sensor.py +++ b/homeassistant/components/hive/sensor.py @@ -40,9 +40,9 @@ class HiveSensorEntity(HiveEntity, SensorEntity): """Return device information.""" return DeviceInfo( identifiers={(DOMAIN, self.device["device_id"])}, - name=self.device["device_name"], - model=self.device["deviceData"]["model"], manufacturer=self.device["deviceData"]["manufacturer"], + model=self.device["deviceData"]["model"], + name=self.device["device_name"], sw_version=self.device["deviceData"]["version"], via_device=(DOMAIN, self.device["parentDevice"]), ) diff --git a/homeassistant/components/hive/switch.py b/homeassistant/components/hive/switch.py index 9c009e1627c..adfcfa442ee 100644 --- a/homeassistant/components/hive/switch.py +++ b/homeassistant/components/hive/switch.py @@ -39,9 +39,9 @@ class HiveDevicePlug(HiveEntity, SwitchEntity): if self.device["hiveType"] == "activeplug": return DeviceInfo( identifiers={(DOMAIN, self.device["device_id"])}, - name=self.device["device_name"], - model=self.device["deviceData"]["model"], manufacturer=self.device["deviceData"]["manufacturer"], + model=self.device["deviceData"]["model"], + name=self.device["device_name"], sw_version=self.device["deviceData"]["version"], via_device=(DOMAIN, self.device["parentDevice"]), ) diff --git a/homeassistant/components/hive/water_heater.py b/homeassistant/components/hive/water_heater.py index 8cefda074b6..096fc468ecb 100644 --- a/homeassistant/components/hive/water_heater.py +++ b/homeassistant/components/hive/water_heater.py @@ -83,9 +83,9 @@ class HiveWaterHeater(HiveEntity, WaterHeaterEntity): """Return device information.""" return DeviceInfo( identifiers={(DOMAIN, self.device["device_id"])}, - name=self.device["device_name"], - model=self.device["deviceData"]["model"], manufacturer=self.device["deviceData"]["manufacturer"], + model=self.device["deviceData"]["model"], + name=self.device["device_name"], sw_version=self.device["deviceData"]["version"], via_device=(DOMAIN, self.device["parentDevice"]), ) diff --git a/homeassistant/components/home_connect/entity.py b/homeassistant/components/home_connect/entity.py index 12f86059023..b27988f997d 100644 --- a/homeassistant/components/home_connect/entity.py +++ b/homeassistant/components/home_connect/entity.py @@ -4,7 +4,7 @@ import logging from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect -from homeassistant.helpers.entity import Entity +from homeassistant.helpers.entity import DeviceInfo, Entity from .api import HomeConnectDevice from .const import DOMAIN, SIGNAL_UPDATE_ENTITIES @@ -51,14 +51,14 @@ class HomeConnectEntity(Entity): return f"{self.device.appliance.haId}-{self.desc}" @property - def device_info(self): + def device_info(self) -> DeviceInfo: """Return info about the device.""" - return { - "identifiers": {(DOMAIN, self.device.appliance.haId)}, - "name": self.device.appliance.name, - "manufacturer": self.device.appliance.brand, - "model": self.device.appliance.vib, - } + return DeviceInfo( + identifiers={(DOMAIN, self.device.appliance.haId)}, + manufacturer=self.device.appliance.brand, + model=self.device.appliance.vib, + name=self.device.appliance.name, + ) @callback def async_entity_update(self): diff --git a/homeassistant/components/home_plus_control/switch.py b/homeassistant/components/home_plus_control/switch.py index d4167ae1f9e..809a246e631 100644 --- a/homeassistant/components/home_plus_control/switch.py +++ b/homeassistant/components/home_plus_control/switch.py @@ -8,6 +8,7 @@ from homeassistant.components.switch import ( ) from homeassistant.core import callback from homeassistant.helpers import dispatcher +from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import DISPATCHER_REMOVERS, DOMAIN, HW_TYPE, SIGNAL_ADD_ENTITIES @@ -79,18 +80,18 @@ class HomeControlSwitchEntity(CoordinatorEntity, SwitchEntity): return self.idx @property - def device_info(self): + def device_info(self) -> DeviceInfo: """Device information.""" - return { - "identifiers": { + return DeviceInfo( + identifiers={ # Unique identifiers within the domain (DOMAIN, self.unique_id) }, - "name": self.name, - "manufacturer": "Legrand", - "model": HW_TYPE.get(self.module.hw_type), - "sw_version": self.module.fw, - } + manufacturer="Legrand", + model=HW_TYPE.get(self.module.hw_type), + name=self.name, + sw_version=self.module.fw, + ) @property def device_class(self): diff --git a/homeassistant/components/homekit_controller/__init__.py b/homeassistant/components/homekit_controller/__init__.py index 92853faedad..d80b849bf80 100644 --- a/homeassistant/components/homekit_controller/__init__.py +++ b/homeassistant/components/homekit_controller/__init__.py @@ -152,9 +152,9 @@ class HomeKitEntity(Entity): device_info = DeviceInfo( identifiers={(DOMAIN, "serial-number", accessory_serial)}, - name=info.value(CharacteristicsTypes.NAME), manufacturer=info.value(CharacteristicsTypes.MANUFACTURER, ""), model=info.value(CharacteristicsTypes.MODEL, ""), + name=info.value(CharacteristicsTypes.NAME), sw_version=info.value(CharacteristicsTypes.FIRMWARE_REVISION, ""), ) diff --git a/homeassistant/components/homematicip_cloud/alarm_control_panel.py b/homeassistant/components/homematicip_cloud/alarm_control_panel.py index 6249b004d23..d2dee3c3744 100644 --- a/homeassistant/components/homematicip_cloud/alarm_control_panel.py +++ b/homeassistant/components/homematicip_cloud/alarm_control_panel.py @@ -49,9 +49,9 @@ class HomematicipAlarmControlPanelEntity(AlarmControlPanelEntity): """Return device specific attributes.""" return DeviceInfo( identifiers={(HMIPC_DOMAIN, f"ACP {self._home.id}")}, - name=self.name, manufacturer="eQ-3", model=CONST_ALARM_CONTROL_PANEL_NAME, + name=self.name, via_device=(HMIPC_DOMAIN, self._home.id), ) diff --git a/homeassistant/components/homematicip_cloud/binary_sensor.py b/homeassistant/components/homematicip_cloud/binary_sensor.py index 3cf8fc72c56..b1261258bf4 100644 --- a/homeassistant/components/homematicip_cloud/binary_sensor.py +++ b/homeassistant/components/homematicip_cloud/binary_sensor.py @@ -172,12 +172,12 @@ class HomematicipCloudConnectionSensor(HomematicipGenericEntity, BinarySensorEnt def device_info(self) -> DeviceInfo: """Return device specific attributes.""" # Adds a sensor to the existing HAP device - return { - "identifiers": { + return DeviceInfo( + identifiers={ # Serial numbers of Homematic IP device (HMIPC_DOMAIN, self._home.id) } - } + ) @property def icon(self) -> str: diff --git a/homeassistant/components/homematicip_cloud/climate.py b/homeassistant/components/homematicip_cloud/climate.py index df1c3d11f31..ed91559e489 100644 --- a/homeassistant/components/homematicip_cloud/climate.py +++ b/homeassistant/components/homematicip_cloud/climate.py @@ -78,9 +78,9 @@ class HomematicipHeatingGroup(HomematicipGenericEntity, ClimateEntity): """Return device specific attributes.""" return DeviceInfo( identifiers={(HMIPC_DOMAIN, self._device.id)}, - name=self._device.label, manufacturer="eQ-3", model=self._device.modelType, + name=self._device.label, via_device=(HMIPC_DOMAIN, self._device.homeId), ) diff --git a/homeassistant/components/homematicip_cloud/generic_entity.py b/homeassistant/components/homematicip_cloud/generic_entity.py index 2de3ded42db..ecf0549d8b8 100644 --- a/homeassistant/components/homematicip_cloud/generic_entity.py +++ b/homeassistant/components/homematicip_cloud/generic_entity.py @@ -101,9 +101,9 @@ class HomematicipGenericEntity(Entity): # Serial numbers of Homematic IP device (HMIPC_DOMAIN, self._device.id) }, - name=self._device.label, manufacturer=self._device.oem, model=self._device.modelType, + name=self._device.label, sw_version=self._device.firmwareVersion, # Link to the homematic ip access point. via_device=(HMIPC_DOMAIN, self._device.homeId), diff --git a/homeassistant/components/huawei_lte/__init__.py b/homeassistant/components/huawei_lte/__init__.py index 9ee5927695d..b1e95bcd07a 100644 --- a/homeassistant/components/huawei_lte/__init__.py +++ b/homeassistant/components/huawei_lte/__init__.py @@ -651,10 +651,10 @@ class HuaweiLteBaseEntity(Entity): @property def device_info(self) -> DeviceInfo: """Get info for matching with parent router.""" - return { - "identifiers": self.router.device_identifiers, - "connections": self.router.device_connections, - } + return DeviceInfo( + connections=self.router.device_connections, + identifiers=self.router.device_identifiers, + ) async def async_update(self) -> None: """Update state.""" diff --git a/homeassistant/components/hue/light.py b/homeassistant/components/hue/light.py index cc3144b99ca..13a3a70ae53 100644 --- a/homeassistant/components/hue/light.py +++ b/homeassistant/components/hue/light.py @@ -1,4 +1,6 @@ """Support for the Philips Hue lights.""" +from __future__ import annotations + from datetime import timedelta from functools import partial import logging @@ -29,6 +31,7 @@ from homeassistant.components.light import ( from homeassistant.core import callback from homeassistant.exceptions import PlatformNotReady from homeassistant.helpers.debounce import Debouncer +from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -431,7 +434,7 @@ class HueLight(CoordinatorEntity, LightEntity): return [EFFECT_COLORLOOP, EFFECT_RANDOM] @property - def device_info(self): + def device_info(self) -> DeviceInfo | None: """Return the device info.""" if self.light.type in ( GROUP_TYPE_LIGHT_GROUP, @@ -441,22 +444,22 @@ class HueLight(CoordinatorEntity, LightEntity): ): return None - info = { - "identifiers": {(HUE_DOMAIN, self.device_id)}, - "name": self.name, - "manufacturer": self.light.manufacturername, + suggested_area = None + if self.light.id in self._rooms: + suggested_area = self._rooms[self.light.id] + + return DeviceInfo( + identifiers={(HUE_DOMAIN, self.device_id)}, + manufacturer=self.light.manufacturername, # productname added in Hue Bridge API 1.24 # (published 03/05/2018) - "model": self.light.productname or self.light.modelid, + model=self.light.productname or self.light.modelid, + name=self.name, # Not yet exposed as properties in aiohue - "sw_version": self.light.raw["swversion"], - "via_device": (HUE_DOMAIN, self.bridge.api.config.bridgeid), - } - - if self.light.id in self._rooms: - info["suggested_area"] = self._rooms[self.light.id] - - return info + suggested_area=suggested_area, + sw_version=self.light.raw["swversion"], + via_device=(HUE_DOMAIN, self.bridge.api.config.bridgeid), + ) async def async_added_to_hass(self) -> None: """Handle entity being added to Home Assistant.""" diff --git a/homeassistant/components/hue/sensor_device.py b/homeassistant/components/hue/sensor_device.py index 4efb89a913f..92c586ff8e0 100644 --- a/homeassistant/components/hue/sensor_device.py +++ b/homeassistant/components/hue/sensor_device.py @@ -47,9 +47,9 @@ class GenericHueDevice(entity.Entity): """ return entity.DeviceInfo( identifiers={(HUE_DOMAIN, self.device_id)}, - name=self.primary_sensor.name, manufacturer=self.primary_sensor.manufacturername, model=(self.primary_sensor.productname or self.primary_sensor.modelid), + name=self.primary_sensor.name, sw_version=self.primary_sensor.swversion, via_device=(HUE_DOMAIN, self.bridge.api.config.bridgeid), ) diff --git a/homeassistant/components/hunterdouglas_powerview/entity.py b/homeassistant/components/hunterdouglas_powerview/entity.py index 810978ce9b3..50894d59f8b 100644 --- a/homeassistant/components/hunterdouglas_powerview/entity.py +++ b/homeassistant/components/hunterdouglas_powerview/entity.py @@ -43,15 +43,15 @@ class HDEntity(CoordinatorEntity): firmware = self._device_info[DEVICE_FIRMWARE] sw_version = f"{firmware[FIRMWARE_REVISION]}.{firmware[FIRMWARE_SUB_REVISION]}.{firmware[FIRMWARE_BUILD]}" return DeviceInfo( - identifiers={(DOMAIN, self._device_info[DEVICE_SERIAL_NUMBER])}, connections={ (dr.CONNECTION_NETWORK_MAC, self._device_info[DEVICE_MAC_ADDRESS]) }, + identifiers={(DOMAIN, self._device_info[DEVICE_SERIAL_NUMBER])}, + manufacturer=MANUFACTURER, + model=self._device_info[DEVICE_MODEL], name=self._device_info[DEVICE_NAME], suggested_area=self._room_name, - model=self._device_info[DEVICE_MODEL], sw_version=sw_version, - manufacturer=MANUFACTURER, ) diff --git a/homeassistant/components/hvv_departures/binary_sensor.py b/homeassistant/components/hvv_departures/binary_sensor.py index 45ac0e45ad9..a3494a2b6d8 100644 --- a/homeassistant/components/hvv_departures/binary_sensor.py +++ b/homeassistant/components/hvv_departures/binary_sensor.py @@ -11,6 +11,7 @@ from homeassistant.components.binary_sensor import ( BinarySensorEntity, ) from homeassistant.const import ATTR_ATTRIBUTION +from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, DataUpdateCoordinator, @@ -145,8 +146,8 @@ class HvvDepartureBinarySensor(CoordinatorEntity, BinarySensorEntity): @property def device_info(self): """Return the device info for this sensor.""" - return { - "identifiers": { + return DeviceInfo( + identifiers={ ( DOMAIN, self.config_entry.entry_id, @@ -154,9 +155,9 @@ class HvvDepartureBinarySensor(CoordinatorEntity, BinarySensorEntity): self.config_entry.data[CONF_STATION]["type"], ) }, - "name": f"Departures at {self.config_entry.data[CONF_STATION]['name']}", - "manufacturer": MANUFACTURER, - } + manufacturer=MANUFACTURER, + name=f"Departures at {self.config_entry.data[CONF_STATION]['name']}", + ) @property def name(self): diff --git a/homeassistant/components/hvv_departures/sensor.py b/homeassistant/components/hvv_departures/sensor.py index 8a188f7dde8..da52fd878d8 100644 --- a/homeassistant/components/hvv_departures/sensor.py +++ b/homeassistant/components/hvv_departures/sensor.py @@ -8,6 +8,7 @@ from pygti.exceptions import InvalidAuth from homeassistant.components.sensor import SensorEntity from homeassistant.const import ATTR_ATTRIBUTION, ATTR_ID, DEVICE_CLASS_TIMESTAMP from homeassistant.helpers import aiohttp_client +from homeassistant.helpers.entity import DeviceInfo from homeassistant.util import Throttle from homeassistant.util.dt import get_time_zone, utcnow @@ -158,8 +159,8 @@ class HVVDepartureSensor(SensorEntity): @property def device_info(self): """Return the device info for this sensor.""" - return { - "identifiers": { + return DeviceInfo( + identifiers={ ( DOMAIN, self.config_entry.entry_id, @@ -167,9 +168,9 @@ class HVVDepartureSensor(SensorEntity): self.config_entry.data[CONF_STATION]["type"], ) }, - "name": self._name, - "manufacturer": MANUFACTURER, - } + manufacturer=MANUFACTURER, + name=self._name, + ) @property def name(self): diff --git a/homeassistant/components/hyperion/camera.py b/homeassistant/components/hyperion/camera.py index d172d00c021..c1763c3c21c 100644 --- a/homeassistant/components/hyperion/camera.py +++ b/homeassistant/components/hyperion/camera.py @@ -249,12 +249,12 @@ class HyperionCamera(Camera): @property def device_info(self) -> DeviceInfo: """Return device information.""" - return { - "identifiers": {(DOMAIN, self._device_id)}, - "name": self._instance_name, - "manufacturer": HYPERION_MANUFACTURER_NAME, - "model": HYPERION_MODEL_NAME, - } + return DeviceInfo( + identifiers={(DOMAIN, self._device_id)}, + manufacturer=HYPERION_MANUFACTURER_NAME, + model=HYPERION_MODEL_NAME, + name=self._instance_name, + ) CAMERA_TYPES = { diff --git a/homeassistant/components/hyperion/light.py b/homeassistant/components/hyperion/light.py index d27e96e85de..0c0070d0c23 100644 --- a/homeassistant/components/hyperion/light.py +++ b/homeassistant/components/hyperion/light.py @@ -240,12 +240,12 @@ class HyperionBaseLight(LightEntity): @property def device_info(self) -> DeviceInfo: """Return device information.""" - return { - "identifiers": {(DOMAIN, self._device_id)}, - "name": self._instance_name, - "manufacturer": HYPERION_MANUFACTURER_NAME, - "model": HYPERION_MODEL_NAME, - } + return DeviceInfo( + identifiers={(DOMAIN, self._device_id)}, + manufacturer=HYPERION_MANUFACTURER_NAME, + model=HYPERION_MODEL_NAME, + name=self._instance_name, + ) def _get_option(self, key: str) -> Any: """Get a value from the provided options.""" diff --git a/homeassistant/components/hyperion/switch.py b/homeassistant/components/hyperion/switch.py index d36fcd79836..1c884cca908 100644 --- a/homeassistant/components/hyperion/switch.py +++ b/homeassistant/components/hyperion/switch.py @@ -185,12 +185,12 @@ class HyperionComponentSwitch(SwitchEntity): @property def device_info(self) -> DeviceInfo: """Return device information.""" - return { - "identifiers": {(DOMAIN, self._device_id)}, - "name": self._instance_name, - "manufacturer": HYPERION_MANUFACTURER_NAME, - "model": HYPERION_MODEL_NAME, - } + return DeviceInfo( + identifiers={(DOMAIN, self._device_id)}, + manufacturer=HYPERION_MANUFACTURER_NAME, + model=HYPERION_MODEL_NAME, + name=self._instance_name, + ) async def _async_send_set_component(self, value: bool) -> None: """Send a component control request."""