Fix vera typing (#65051)

This commit is contained in:
Marc Mueller 2022-01-27 17:00:30 +01:00 committed by GitHub
parent ca469750ac
commit c3967dec10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,13 +2,14 @@
from __future__ import annotations from __future__ import annotations
from collections import defaultdict from collections import defaultdict
from datetime import datetime
from typing import NamedTuple from typing import NamedTuple
import pyvera as pv import pyvera as pv
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform from homeassistant.const import Platform
from homeassistant.core import HomeAssistant from homeassistant.core import CALLBACK_TYPE, HomeAssistant
from homeassistant.helpers.event import call_later from homeassistant.helpers.event import call_later
from .const import DOMAIN from .const import DOMAIN
@ -56,7 +57,7 @@ class SubscriptionRegistry(pv.AbstractSubscriptionRegistry):
"""Initialize the object.""" """Initialize the object."""
super().__init__() super().__init__()
self._hass = hass self._hass = hass
self._cancel_poll = None self._cancel_poll: CALLBACK_TYPE | None = None
def start(self) -> None: def start(self) -> None:
"""Start polling for data.""" """Start polling for data."""
@ -72,7 +73,7 @@ class SubscriptionRegistry(pv.AbstractSubscriptionRegistry):
def _schedule_poll(self, delay: float) -> None: def _schedule_poll(self, delay: float) -> None:
self._cancel_poll = call_later(self._hass, delay, self._run_poll_server) self._cancel_poll = call_later(self._hass, delay, self._run_poll_server)
def _run_poll_server(self, now) -> None: def _run_poll_server(self, now: datetime) -> None:
delay = 1 delay = 1
# Long poll for changes. The downstream API instructs the endpoint to wait a # Long poll for changes. The downstream API instructs the endpoint to wait a