From 2841e402b918faa75a73b4f2126b412735a324eb Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 12 Nov 2021 18:03:57 +0100 Subject: [PATCH] Cleanup extra dict from hass data in Elgato (#59587) --- homeassistant/components/elgato/__init__.py | 5 ++--- homeassistant/components/elgato/const.py | 3 --- homeassistant/components/elgato/light.py | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/elgato/__init__.py b/homeassistant/components/elgato/__init__.py index 21b8de53c17..0c42e359d07 100644 --- a/homeassistant/components/elgato/__init__.py +++ b/homeassistant/components/elgato/__init__.py @@ -10,7 +10,7 @@ from homeassistant.core import HomeAssistant from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.aiohttp_client import async_get_clientsession -from .const import DATA_ELGATO_CLIENT, DOMAIN +from .const import DOMAIN PLATFORMS = [LIGHT_DOMAIN] @@ -31,8 +31,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: logging.getLogger(__name__).debug("Unable to connect: %s", exception) raise ConfigEntryNotReady from exception - hass.data.setdefault(DOMAIN, {}) - hass.data[DOMAIN][entry.entry_id] = {DATA_ELGATO_CLIENT: elgato} + hass.data.setdefault(DOMAIN, {})[entry.entry_id] = elgato hass.config_entries.async_setup_platforms(entry, PLATFORMS) return True diff --git a/homeassistant/components/elgato/const.py b/homeassistant/components/elgato/const.py index 03a52b7e305..6e63b598346 100644 --- a/homeassistant/components/elgato/const.py +++ b/homeassistant/components/elgato/const.py @@ -3,9 +3,6 @@ # Integration domain DOMAIN = "elgato" -# Home Assistant data keys -DATA_ELGATO_CLIENT = "elgato_client" - # Attributes ATTR_ON = "on" diff --git a/homeassistant/components/elgato/light.py b/homeassistant/components/elgato/light.py index 8ed443b65e1..d8a6e74c41a 100644 --- a/homeassistant/components/elgato/light.py +++ b/homeassistant/components/elgato/light.py @@ -23,7 +23,7 @@ from homeassistant.helpers.entity_platform import ( async_get_current_platform, ) -from .const import DATA_ELGATO_CLIENT, DOMAIN, SERVICE_IDENTIFY +from .const import DOMAIN, SERVICE_IDENTIFY _LOGGER = logging.getLogger(__name__) @@ -37,7 +37,7 @@ async def async_setup_entry( async_add_entities: AddEntitiesCallback, ) -> None: """Set up Elgato Light based on a config entry.""" - elgato: Elgato = hass.data[DOMAIN][entry.entry_id][DATA_ELGATO_CLIENT] + elgato: Elgato = hass.data[DOMAIN][entry.entry_id] info = await elgato.info() settings = await elgato.settings() async_add_entities([ElgatoLight(elgato, info, settings)], True)