From 0157ebeeef3c36dd23cc14b02347e00fe4ab2106 Mon Sep 17 00:00:00 2001 From: "Alan D. Tse" Date: Sun, 9 Feb 2020 10:55:44 -0800 Subject: [PATCH] fix: load found devices when load delay required fixes #552 --- custom_components/alexa_media/sensor.py | 8 ++++++++ custom_components/alexa_media/switch.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/custom_components/alexa_media/sensor.py b/custom_components/alexa_media/sensor.py index 491dae6e..f9c525e5 100644 --- a/custom_components/alexa_media/sensor.py +++ b/custom_components/alexa_media/sensor.py @@ -69,6 +69,14 @@ async def async_setup_platform(hass, config, add_devices_callback, discovery_inf hide_email(account), hide_serial(key), ) + if devices: + await add_devices( + hide_email(account), + devices, + add_devices_callback, + include_filter, + exclude_filter, + ) return False if key not in (account_dict["entities"]["sensor"]): (account_dict["entities"]["sensor"][key]) = {} diff --git a/custom_components/alexa_media/switch.py b/custom_components/alexa_media/switch.py index c749a483..37b3023a 100644 --- a/custom_components/alexa_media/switch.py +++ b/custom_components/alexa_media/switch.py @@ -50,6 +50,14 @@ async def async_setup_platform(hass, config, add_devices_callback, discovery_inf hide_email(account), hide_serial(key), ) + if devices: + await add_devices( + hide_email(account), + devices, + add_devices_callback, + include_filter, + exclude_filter, + ) return False if key not in ( hass.data[DATA_ALEXAMEDIA]["accounts"][account]["entities"]["switch"]