diff --git a/homeassistant/components/elgato/const.py b/homeassistant/components/elgato/const.py index 8b931fc6328..1cfb48390cf 100644 --- a/homeassistant/components/elgato/const.py +++ b/homeassistant/components/elgato/const.py @@ -7,11 +7,7 @@ DOMAIN = "elgato" DATA_ELGATO_CLIENT = "elgato_client" # Attributes -ATTR_IDENTIFIERS = "identifiers" -ATTR_MANUFACTURER = "manufacturer" -ATTR_MODEL = "model" ATTR_ON = "on" -ATTR_SOFTWARE_VERSION = "sw_version" CONF_SERIAL_NUMBER = "serial_number" diff --git a/homeassistant/components/elgato/light.py b/homeassistant/components/elgato/light.py index 7f4987b2620..7ec21dd9f20 100644 --- a/homeassistant/components/elgato/light.py +++ b/homeassistant/components/elgato/light.py @@ -15,6 +15,13 @@ from homeassistant.components.light import ( LightEntity, ) from homeassistant.config_entries import ConfigEntry +from homeassistant.const import ( + ATTR_IDENTIFIERS, + ATTR_MANUFACTURER, + ATTR_MODEL, + ATTR_NAME, + ATTR_SW_VERSION, +) from homeassistant.core import HomeAssistant from homeassistant.helpers.entity import DeviceInfo, Entity from homeassistant.helpers.entity_platform import async_get_current_platform @@ -146,11 +153,11 @@ class ElgatoLight(LightEntity): def device_info(self) -> DeviceInfo: """Return device information about this Elgato Key Light.""" return { - "identifiers": {(DOMAIN, self._info.serial_number)}, - "name": self._info.product_name, - "manufacturer": "Elgato", - "model": self._info.product_name, - "sw_version": f"{self._info.firmware_version} ({self._info.firmware_build_number})", + ATTR_IDENTIFIERS: {(DOMAIN, self._info.serial_number)}, + ATTR_NAME: self._info.product_name, + ATTR_MANUFACTURER: "Elgato", + ATTR_MODEL: self._info.product_name, + ATTR_SW_VERSION: f"{self._info.firmware_version} ({self._info.firmware_build_number})", } async def async_identify(self) -> None: diff --git a/homeassistant/const.py b/homeassistant/const.py index cb0e435c8d1..8aafc77356d 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,4 +1,6 @@ """Constants used by Home Assistant components.""" +from typing import Final + MAJOR_VERSION = 2021 MINOR_VERSION = 6 PATCH_VERSION = "0.dev0" @@ -289,7 +291,7 @@ ATTR_SERVICE_DATA = "service_data" ATTR_ID = "id" # Name -ATTR_NAME = "name" +ATTR_NAME: Final = "name" # Contains one string or a list of strings, each being an entity id ATTR_ENTITY_ID = "entity_id" @@ -306,6 +308,8 @@ ATTR_FRIENDLY_NAME = "friendly_name" # A picture to represent entity ATTR_ENTITY_PICTURE = "entity_picture" +ATTR_IDENTIFIERS: Final = "identifiers" + # Icon to use in the frontend ATTR_ICON = "icon" @@ -323,6 +327,10 @@ ATTR_LOCATION = "location" ATTR_MODE = "mode" +ATTR_MANUFACTURER: Final = "manufacturer" +ATTR_MODEL: Final = "model" +ATTR_SW_VERSION: Final = "sw_version" + ATTR_BATTERY_CHARGING = "battery_charging" ATTR_BATTERY_LEVEL = "battery_level" ATTR_WAKEUP = "wake_up_interval"