diff --git a/homeassistant/core.py b/homeassistant/core.py index b8d159893fe..5685b479d1c 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -349,7 +349,9 @@ class HomeAssistant: self.bus.async_fire(EVENT_HOMEASSISTANT_STARTED) _async_create_timer(self) - def add_job(self, target: Callable[..., Any], *args: Any) -> None: + def add_job( + self, target: Callable[..., Any] | Coroutine[Any, Any, Any], *args: Any + ) -> None: """Add a job to be executed by the event loop or by an executor. If the job is either a coroutine or decorated with @callback, it will be diff --git a/homeassistant/helpers/discovery.py b/homeassistant/helpers/discovery.py index ed90b5b893b..20819ac7504 100644 --- a/homeassistant/helpers/discovery.py +++ b/homeassistant/helpers/discovery.py @@ -66,11 +66,7 @@ def discover( hass_config: ConfigType, ) -> None: """Fire discovery event. Can ensure a component is loaded.""" - hass.add_job( - async_discover( # type: ignore - hass, service, discovered, component, hass_config - ) - ) + hass.add_job(async_discover(hass, service, discovered, component, hass_config)) @bind_hass @@ -131,9 +127,7 @@ def load_platform( ) -> None: """Load a component and platform dynamically.""" hass.add_job( - async_load_platform( # type: ignore - hass, component, platform, discovered, hass_config - ) + async_load_platform(hass, component, platform, discovered, hass_config) ) diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index e9038d1f658..bf2e13c1e24 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -674,7 +674,7 @@ class Entity(ABC): If state is changed more than once before the ha state change task has been executed, the intermediate state transitions will be missed. """ - self.hass.add_job(self.async_update_ha_state(force_refresh)) # type: ignore + self.hass.add_job(self.async_update_ha_state(force_refresh)) @callback def async_schedule_update_ha_state(self, force_refresh: bool = False) -> None: diff --git a/homeassistant/helpers/entity_component.py b/homeassistant/helpers/entity_component.py index da6732d05e7..a1dba0d6962 100644 --- a/homeassistant/helpers/entity_component.py +++ b/homeassistant/helpers/entity_component.py @@ -105,7 +105,7 @@ class EntityComponent: This doesn't block the executor to protect from deadlocks. """ - self.hass.add_job(self.async_setup(config)) # type: ignore + self.hass.add_job(self.async_setup(config)) async def async_setup(self, config: ConfigType) -> None: """Set up a full entity component.