Type hint improvements (#28260)
* Add and improve core and config_entries type hints * Complete and improve config_entries type hints * More entity registry type hints * Complete helpers.event type hints
This commit is contained in:
parent
f7a64019b6
commit
f88ead597a
9 changed files with 135 additions and 89 deletions
|
@ -12,7 +12,7 @@ from homeassistant.const import (
|
|||
STATE_ON,
|
||||
STATE_UNAVAILABLE,
|
||||
)
|
||||
from homeassistant.core import State, callback
|
||||
from homeassistant.core import CALLBACK_TYPE, State, callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_state_change
|
||||
|
@ -56,7 +56,7 @@ class LightSwitch(Light):
|
|||
self._switch_entity_id = switch_entity_id
|
||||
self._is_on = False
|
||||
self._available = False
|
||||
self._async_unsub_state_changed = None
|
||||
self._async_unsub_state_changed: Optional[CALLBACK_TYPE] = None
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
|
@ -113,6 +113,7 @@ class LightSwitch(Light):
|
|||
"""Handle child updates."""
|
||||
self.async_schedule_update_ha_state(True)
|
||||
|
||||
assert self.hass is not None
|
||||
self._async_unsub_state_changed = async_track_state_change(
|
||||
self.hass, self._switch_entity_id, async_state_changed_listener
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue