mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Move evohome hasskey to const module (#162899)
This commit is contained in:
@@ -38,7 +38,6 @@ from homeassistant.helpers.discovery import async_load_platform
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_send
|
||||
from homeassistant.helpers.service import verify_domain_control
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.util.hass_dict import HassKey
|
||||
|
||||
from .const import (
|
||||
ATTR_DURATION,
|
||||
@@ -47,6 +46,7 @@ from .const import (
|
||||
ATTR_SETPOINT,
|
||||
CONF_LOCATION_IDX,
|
||||
DOMAIN,
|
||||
EVOHOME_DATA,
|
||||
SCAN_INTERVAL_DEFAULT,
|
||||
SCAN_INTERVAL_MINIMUM,
|
||||
EvoService,
|
||||
@@ -90,8 +90,6 @@ SET_ZONE_OVERRIDE_SCHEMA: Final = vol.Schema(
|
||||
}
|
||||
)
|
||||
|
||||
EVOHOME_KEY: HassKey[EvoData] = HassKey(DOMAIN)
|
||||
|
||||
|
||||
@dataclass
|
||||
class EvoData:
|
||||
@@ -130,7 +128,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
|
||||
assert coordinator.tcs is not None # mypy
|
||||
|
||||
hass.data[EVOHOME_KEY] = EvoData(
|
||||
hass.data[EVOHOME_DATA] = EvoData(
|
||||
coordinator=coordinator,
|
||||
loc_idx=coordinator.loc_idx,
|
||||
tcs=coordinator.tcs,
|
||||
|
||||
@@ -41,12 +41,12 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from . import EVOHOME_KEY
|
||||
from .const import (
|
||||
ATTR_DURATION,
|
||||
ATTR_DURATION_UNTIL,
|
||||
ATTR_PERIOD,
|
||||
ATTR_SETPOINT,
|
||||
EVOHOME_DATA,
|
||||
EvoService,
|
||||
)
|
||||
from .coordinator import EvoDataUpdateCoordinator
|
||||
@@ -85,9 +85,9 @@ async def async_setup_platform(
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
||||
coordinator = hass.data[EVOHOME_KEY].coordinator
|
||||
loc_idx = hass.data[EVOHOME_KEY].loc_idx
|
||||
tcs = hass.data[EVOHOME_KEY].tcs
|
||||
coordinator = hass.data[EVOHOME_DATA].coordinator
|
||||
loc_idx = hass.data[EVOHOME_DATA].loc_idx
|
||||
tcs = hass.data[EVOHOME_DATA].tcs
|
||||
|
||||
_LOGGER.debug(
|
||||
"Found the Location/Controller (%s), id=%s, name=%s (location_idx=%s)",
|
||||
|
||||
@@ -4,9 +4,15 @@ from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
from enum import StrEnum, unique
|
||||
from typing import Final
|
||||
from typing import TYPE_CHECKING, Final
|
||||
|
||||
from homeassistant.util.hass_dict import HassKey
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from . import EvoData
|
||||
|
||||
DOMAIN: Final = "evohome"
|
||||
EVOHOME_DATA: HassKey[EvoData] = HassKey(DOMAIN)
|
||||
|
||||
STORAGE_VER: Final = 1
|
||||
STORAGE_KEY: Final = DOMAIN
|
||||
|
||||
@@ -25,7 +25,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from . import EVOHOME_KEY
|
||||
from .const import EVOHOME_DATA
|
||||
from .coordinator import EvoDataUpdateCoordinator
|
||||
from .entity import EvoChild
|
||||
|
||||
@@ -47,8 +47,8 @@ async def async_setup_platform(
|
||||
if discovery_info is None:
|
||||
return
|
||||
|
||||
coordinator = hass.data[EVOHOME_KEY].coordinator
|
||||
tcs = hass.data[EVOHOME_KEY].tcs
|
||||
coordinator = hass.data[EVOHOME_DATA].coordinator
|
||||
tcs = hass.data[EVOHOME_DATA].tcs
|
||||
|
||||
assert tcs.hotwater is not None # mypy check
|
||||
|
||||
|
||||
Reference in New Issue
Block a user