diff --git a/homeassistant/core.py b/homeassistant/core.py index c49777a67fb779..f7a3666e4a1936 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -508,6 +508,11 @@ def add_job( """ if target is None: raise ValueError("Don't call add_job with None") + if asyncio.iscoroutine(target): + self.loop.call_soon_threadsafe(self.async_add_job, target) + return + if TYPE_CHECKING: + target = cast(Callable[..., Any], target) self.loop.call_soon_threadsafe(self.async_add_job, target, *args) @overload