From 7ead77eea6d536e13263fdf8cb33ae5dbbdddc7d Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 27 Sep 2022 17:32:54 +0200 Subject: [PATCH] Correct typing of async_track_state_change (#79150) * Correct typing of async_track_state_change * Update integrations --- homeassistant/components/proximity/__init__.py | 5 ++++- homeassistant/helpers/event.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/proximity/__init__.py b/homeassistant/components/proximity/__init__.py index 47dd663561c1..7a54b11ef345 100644 --- a/homeassistant/components/proximity/__init__.py +++ b/homeassistant/components/proximity/__init__.py @@ -157,9 +157,12 @@ class Proximity(Entity): return {ATTR_DIR_OF_TRAVEL: self.dir_of_travel, ATTR_NEAREST: self.nearest} def check_proximity_state_change( - self, entity: str, old_state: State | None, new_state: State + self, entity: str, old_state: State | None, new_state: State | None ) -> None: """Perform the proximity checking.""" + if new_state is None: + return + entity_name = new_state.name devices_to_calculate = False devices_in_zone = "" diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py index 1cea1860b388..107567c98ce8 100644 --- a/homeassistant/helpers/event.py +++ b/homeassistant/helpers/event.py @@ -141,7 +141,9 @@ def threaded_listener_factory( def async_track_state_change( hass: HomeAssistant, entity_ids: str | Iterable[str], - action: Callable[[str, State | None, State], Coroutine[Any, Any, None] | None], + action: Callable[ + [str, State | None, State | None], Coroutine[Any, Any, None] | None + ], from_state: None | str | Iterable[str] = None, to_state: None | str | Iterable[str] = None, ) -> CALLBACK_TYPE: