mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Restore dictionary constants in Elgato device info (#50013)
This commit is contained in:
parent
d4565c0e27
commit
982c12bcc9
@ -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"
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user