mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Explicitly pass in the config_entry in deluge coordinator (#137733)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
2d72b814d6
commit
88a2b2ab90
@ -7,7 +7,6 @@ from ssl import SSLError
|
||||
|
||||
from deluge_client.client import DelugeRPCClient
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_PASSWORD,
|
||||
@ -19,12 +18,11 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||
|
||||
from .const import CONF_WEB_PORT
|
||||
from .coordinator import DelugeDataUpdateCoordinator
|
||||
from .coordinator import DelugeConfigEntry, DelugeDataUpdateCoordinator
|
||||
|
||||
PLATFORMS = [Platform.SENSOR, Platform.SWITCH]
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
type DelugeConfigEntry = ConfigEntry[DelugeDataUpdateCoordinator]
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: DelugeConfigEntry) -> bool:
|
||||
|
@ -4,10 +4,11 @@ from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
from ssl import SSLError
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import Any
|
||||
|
||||
from deluge_client.client import DelugeRPCClient, FailedToReconnectException
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||
@ -15,8 +16,7 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, Upda
|
||||
|
||||
from .const import LOGGER, DelugeGetSessionStatusKeys
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from . import DelugeConfigEntry
|
||||
type DelugeConfigEntry = ConfigEntry[DelugeDataUpdateCoordinator]
|
||||
|
||||
|
||||
class DelugeDataUpdateCoordinator(
|
||||
@ -33,11 +33,11 @@ class DelugeDataUpdateCoordinator(
|
||||
super().__init__(
|
||||
hass=hass,
|
||||
logger=LOGGER,
|
||||
config_entry=entry,
|
||||
name=entry.title,
|
||||
update_interval=timedelta(seconds=30),
|
||||
)
|
||||
self.api = api
|
||||
self.config_entry = entry
|
||||
|
||||
async def _async_update_data(self) -> dict[Platform, dict[str, Any]]:
|
||||
"""Get the latest data from Deluge and updates the state."""
|
||||
|
@ -17,9 +17,8 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import StateType
|
||||
|
||||
from . import DelugeConfigEntry
|
||||
from .const import DelugeGetSessionStatusKeys, DelugeSensorType
|
||||
from .coordinator import DelugeDataUpdateCoordinator
|
||||
from .coordinator import DelugeConfigEntry, DelugeDataUpdateCoordinator
|
||||
from .entity import DelugeEntity
|
||||
|
||||
|
||||
|
@ -9,8 +9,7 @@ from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import DelugeConfigEntry
|
||||
from .coordinator import DelugeDataUpdateCoordinator
|
||||
from .coordinator import DelugeConfigEntry, DelugeDataUpdateCoordinator
|
||||
from .entity import DelugeEntity
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user