Move typed ConfigEntry to coordinator module in point (#160786)

This commit is contained in:
epenet
2026-01-12 16:34:38 +01:00
committed by GitHub
parent 41a423e140
commit f9b32811b2
5 changed files with 10 additions and 15 deletions

View File

@@ -7,7 +7,6 @@ from aiohttp import ClientError, ClientResponseError, web
from pypoint import PointSession
from homeassistant.components import webhook
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_WEBHOOK_ID, Platform
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
@@ -21,14 +20,12 @@ from homeassistant.helpers.dispatcher import async_dispatcher_send
from . import api
from .const import CONF_WEBHOOK_URL, DOMAIN, EVENT_RECEIVED, SIGNAL_WEBHOOK
from .coordinator import PointDataUpdateCoordinator
from .coordinator import PointConfigEntry, PointDataUpdateCoordinator
_LOGGER = logging.getLogger(__name__)
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
type PointConfigEntry = ConfigEntry[PointDataUpdateCoordinator]
async def async_setup_entry(hass: HomeAssistant, entry: PointConfigEntry) -> bool:
"""Set up Minut Point from a config entry."""

View File

@@ -16,8 +16,8 @@ from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from . import PointConfigEntry
from .const import DOMAIN, SIGNAL_WEBHOOK
from .coordinator import PointConfigEntry
_LOGGER = logging.getLogger(__name__)

View File

@@ -15,9 +15,8 @@ from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from . import PointConfigEntry
from .const import SIGNAL_WEBHOOK
from .coordinator import PointDataUpdateCoordinator
from .coordinator import PointConfigEntry, PointDataUpdateCoordinator
from .entity import MinutPointEntity
_LOGGER = logging.getLogger(__name__)

View File

@@ -3,29 +3,29 @@
from collections.abc import Callable
from datetime import datetime
import logging
from typing import TYPE_CHECKING, Any
from typing import Any
from pypoint import PointSession
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.util.dt import parse_datetime
from .const import DOMAIN, SCAN_INTERVAL
if TYPE_CHECKING:
from . import PointConfigEntry
_LOGGER = logging.getLogger(__name__)
type PointConfigEntry = ConfigEntry[PointDataUpdateCoordinator]
class PointDataUpdateCoordinator(DataUpdateCoordinator[dict[str, dict[str, Any]]]):
"""Class to manage fetching Point data from the API."""
config_entry: "PointConfigEntry"
config_entry: PointConfigEntry
def __init__(
self, hass: HomeAssistant, point: PointSession, config_entry: "PointConfigEntry"
self, hass: HomeAssistant, point: PointSession, config_entry: PointConfigEntry
) -> None:
"""Initialize."""
super().__init__(

View File

@@ -14,8 +14,7 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback
from homeassistant.helpers.typing import StateType
from . import PointConfigEntry
from .coordinator import PointDataUpdateCoordinator
from .coordinator import PointConfigEntry, PointDataUpdateCoordinator
from .entity import MinutPointEntity
_LOGGER = logging.getLogger(__name__)