diff --git a/homeassistant/components/airvisual/__init__.py b/homeassistant/components/airvisual/__init__.py index d9359e81e4b..d0e1a741f2e 100644 --- a/homeassistant/components/airvisual/__init__.py +++ b/homeassistant/components/airvisual/__init__.py @@ -44,7 +44,6 @@ from .const import ( CONF_COUNTRY, CONF_GEOGRAPHIES, CONF_INTEGRATION_TYPE, - DATA_COORDINATOR, DOMAIN, INTEGRATION_TYPE_GEOGRAPHY_COORDS, INTEGRATION_TYPE_GEOGRAPHY_NAME, @@ -106,9 +105,8 @@ def async_get_cloud_coordinators_by_api_key( """Get all DataUpdateCoordinator objects related to a particular API key.""" return [ coordinator - for entry_id, attrs in hass.data[DOMAIN].items() + for entry_id, coordinator in hass.data[DOMAIN].items() if (entry := hass.config_entries.async_get_entry(entry_id)) - and (coordinator := attrs.get(DATA_COORDINATOR)) and entry.data.get(CONF_API_KEY) == api_key ] @@ -270,7 +268,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: await coordinator.async_config_entry_first_refresh() hass.data.setdefault(DOMAIN, {}) - hass.data[DOMAIN][entry.entry_id] = {DATA_COORDINATOR: coordinator} + hass.data[DOMAIN][entry.entry_id] = coordinator # Reassess the interval between 2 server requests if CONF_API_KEY in entry.data: diff --git a/homeassistant/components/airvisual/const.py b/homeassistant/components/airvisual/const.py index 510ada2b68c..8e2c08eb896 100644 --- a/homeassistant/components/airvisual/const.py +++ b/homeassistant/components/airvisual/const.py @@ -12,5 +12,3 @@ CONF_CITY = "city" CONF_COUNTRY = "country" CONF_GEOGRAPHIES = "geographies" CONF_INTEGRATION_TYPE = "integration_type" - -DATA_COORDINATOR = "coordinator" diff --git a/homeassistant/components/airvisual/sensor.py b/homeassistant/components/airvisual/sensor.py index 13b87112716..52d046cef42 100644 --- a/homeassistant/components/airvisual/sensor.py +++ b/homeassistant/components/airvisual/sensor.py @@ -32,7 +32,6 @@ from .const import ( CONF_CITY, CONF_COUNTRY, CONF_INTEGRATION_TYPE, - DATA_COORDINATOR, DOMAIN, INTEGRATION_TYPE_GEOGRAPHY_COORDS, INTEGRATION_TYPE_GEOGRAPHY_NAME, @@ -185,7 +184,7 @@ async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback ) -> None: """Set up AirVisual sensors based on a config entry.""" - coordinator = hass.data[DOMAIN][entry.entry_id][DATA_COORDINATOR] + coordinator = hass.data[DOMAIN][entry.entry_id] sensors: list[AirVisualGeographySensor | AirVisualNodeProSensor] if entry.data[CONF_INTEGRATION_TYPE] in (