Improve DataUpdateCoordinator typing in integrations (2) (#84656)
This commit is contained in:
parent
1de41ab123
commit
06db5476e4
9 changed files with 26 additions and 21 deletions
|
@ -7,7 +7,7 @@ import logging
|
|||
|
||||
from async_timeout import timeout
|
||||
from canary.api import Api
|
||||
from canary.model import Location
|
||||
from canary.model import Location, Reading
|
||||
from requests.exceptions import ConnectTimeout, HTTPError
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
@ -19,7 +19,7 @@ from .model import CanaryData
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CanaryDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
class CanaryDataUpdateCoordinator(DataUpdateCoordinator[CanaryData]):
|
||||
"""Class to manage fetching Canary data."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, *, api: Api) -> None:
|
||||
|
@ -37,7 +37,7 @@ class CanaryDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
def _update_data(self) -> CanaryData:
|
||||
"""Fetch data from Canary via sync functions."""
|
||||
locations_by_id: dict[str, Location] = {}
|
||||
readings_by_device_id: dict[str, ValuesView] = {}
|
||||
readings_by_device_id: dict[str, ValuesView[Reading]] = {}
|
||||
|
||||
for location in self.canary.get_locations():
|
||||
location_id = location.location_id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue