From dfb08e7efd8c5c1fc77ecbaa447440802d4f881b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 20 Dec 2023 12:57:20 -1000 Subject: [PATCH] Remove unneeded usage of run_callback_threadsafe in entity helper (#106138) We do not need to create a future here as we do not need to wait for the result as its going to run in the background in a task anyways --- homeassistant/helpers/entity_platform.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/homeassistant/helpers/entity_platform.py b/homeassistant/helpers/entity_platform.py index be087241287..221203902c5 100644 --- a/homeassistant/helpers/entity_platform.py +++ b/homeassistant/helpers/entity_platform.py @@ -31,7 +31,6 @@ from homeassistant.core import ( from homeassistant.exceptions import HomeAssistantError, PlatformNotReady from homeassistant.generated import languages from homeassistant.setup import async_start_setup -from homeassistant.util.async_ import run_callback_threadsafe from . import ( config_validation as cv, @@ -429,12 +428,11 @@ class EntityPlatform: self, new_entities: Iterable[Entity], update_before_add: bool = False ) -> None: """Schedule adding entities for a single platform, synchronously.""" - run_callback_threadsafe( - self.hass.loop, + self.hass.loop.call_soon_threadsafe( self._async_schedule_add_entities, list(new_entities), update_before_add, - ).result() + ) @callback def _async_schedule_add_entities(