mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 20:25:07 +02:00
Use typed config entry in husqvarna_automower (#132346)
This commit is contained in:
@@ -89,7 +89,9 @@ async def async_unload_entry(hass: HomeAssistant, entry: AutomowerConfigEntry) -
|
||||
|
||||
|
||||
def cleanup_removed_devices(
|
||||
hass: HomeAssistant, config_entry: ConfigEntry, available_devices: list[str]
|
||||
hass: HomeAssistant,
|
||||
config_entry: AutomowerConfigEntry,
|
||||
available_devices: list[str],
|
||||
) -> None:
|
||||
"""Cleanup entity and device registry from removed devices."""
|
||||
device_reg = dr.async_get(hass)
|
||||
@@ -104,7 +106,7 @@ def cleanup_removed_devices(
|
||||
|
||||
def remove_work_area_entities(
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
config_entry: AutomowerConfigEntry,
|
||||
removed_work_areas: set[int],
|
||||
mower_id: str,
|
||||
) -> None:
|
||||
|
@@ -1,8 +1,11 @@
|
||||
"""Data UpdateCoordinator for the Husqvarna Automower integration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from aioautomower.exceptions import (
|
||||
ApiException,
|
||||
@@ -13,13 +16,15 @@ from aioautomower.exceptions import (
|
||||
from aioautomower.model import MowerAttributes
|
||||
from aioautomower.session import AutomowerSession
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from . import AutomowerConfigEntry
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
MAX_WS_RECONNECT_TIME = 600
|
||||
SCAN_INTERVAL = timedelta(minutes=8)
|
||||
@@ -29,7 +34,7 @@ DEFAULT_RECONNECT_TIME = 2 # Define a default reconnect time
|
||||
class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[dict[str, MowerAttributes]]):
|
||||
"""Class to manage fetching Husqvarna data."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
config_entry: AutomowerConfigEntry
|
||||
|
||||
def __init__(self, hass: HomeAssistant, api: AutomowerSession) -> None:
|
||||
"""Initialize data updater."""
|
||||
@@ -64,7 +69,7 @@ class AutomowerDataUpdateCoordinator(DataUpdateCoordinator[dict[str, MowerAttrib
|
||||
async def client_listen(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
entry: ConfigEntry,
|
||||
entry: AutomowerConfigEntry,
|
||||
automower_client: AutomowerSession,
|
||||
) -> None:
|
||||
"""Listen with the client."""
|
||||
|
@@ -6,7 +6,6 @@ import logging
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.diagnostics import async_redact_data
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_ACCESS_TOKEN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceEntry
|
||||
@@ -26,7 +25,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_get_config_entry_diagnostics(
|
||||
hass: HomeAssistant, entry: ConfigEntry
|
||||
hass: HomeAssistant, entry: AutomowerConfigEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
return async_redact_data(entry.as_dict(), TO_REDACT)
|
||||
|
Reference in New Issue
Block a user