Move async_add_entities back to event loop for tplink component (#42454)
This commit is contained in:
1 parent
e21e28e49f
commit
d42bdcfc2a
4 files changed
+24
-13
No files matched your search
@@ -31,10 +31,13 @@ SLEEP_TIME = 2
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistantType, config_entry, async_add_entities):
|
||||
"""Set up switches."""
|
||||
await hass.async_add_executor_job(
|
||||
add_available_devices, hass, CONF_SWITCH, SmartPlugSwitch, async_add_entities
|
||||
entities = await hass.async_add_executor_job(
|
||||
add_available_devices, hass, CONF_SWITCH, SmartPlugSwitch
|
||||
)
|
||||
|
||||
if entities:
|
||||
async_add_entities(entities, update_before_add=True)
|
||||
|
||||
if hass.data[TPLINK_DOMAIN][f"{CONF_SWITCH}_remaining"]:
|
||||
raise PlatformNotReady
|
||||
|
||||
|
||||
Reference in new issue
Block a user