diff --git a/custom_components/mega/binary_sensor.py b/custom_components/mega/binary_sensor.py index 9862c7d..63768b7 100644 --- a/custom_components/mega/binary_sensor.py +++ b/custom_components/mega/binary_sensor.py @@ -70,7 +70,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn async_add_devices(devices) - asyncio.create_task(scan()) + hass.async_create_task(scan()) class MegaBinarySensor(BinarySensorEntity, BaseMegaEntity): diff --git a/custom_components/mega/light.py b/custom_components/mega/light.py index c038d54..2980569 100644 --- a/custom_components/mega/light.py +++ b/custom_components/mega/light.py @@ -86,7 +86,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn devices.append(light) async_add_devices(devices) - asyncio.create_task(scan_ports()) + hass.async_create_task(scan_ports()) class MegaLight(LightEntity, BaseMegaEntity): diff --git a/custom_components/mega/sensor.py b/custom_components/mega/sensor.py index e13a654..cade9ac 100644 --- a/custom_components/mega/sensor.py +++ b/custom_components/mega/sensor.py @@ -112,7 +112,8 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn async_add_devices(devices) - asyncio.create_task(scan()) + hass.async_create_task(scan()) + class Mega1WSensor(BaseMegaEntity):