From 79dc46226a64ee89e8cfb466de3026b2f9b58031 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 14 Jan 2021 22:19:56 +0300 Subject: [PATCH] hotfix --- custom_components/mega/binary_sensor.py | 3 ++- custom_components/mega/light.py | 4 ++-- custom_components/mega/sensor.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/custom_components/mega/binary_sensor.py b/custom_components/mega/binary_sensor.py index 7cd3687..ba81c27 100644 --- a/custom_components/mega/binary_sensor.py +++ b/custom_components/mega/binary_sensor.py @@ -1,5 +1,6 @@ """Platform for light integration.""" import logging +import asyncio import voluptuous as vol @@ -69,7 +70,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn async_add_devices(devices) - await scan() + asyncio.create_task(scan()) class MegaBinarySensor(BinarySensorEntity, BaseMegaEntity): diff --git a/custom_components/mega/light.py b/custom_components/mega/light.py index f9ffc57..38367cb 100644 --- a/custom_components/mega/light.py +++ b/custom_components/mega/light.py @@ -1,6 +1,6 @@ """Platform for light integration.""" import logging - +import asyncio import voluptuous as vol from homeassistant.components.light import ( @@ -85,7 +85,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn devices.append(light) async_add_devices(devices) - await scan_ports() + asyncio.create_task(scan_ports()) class MegaLight(LightEntity, BaseMegaEntity): diff --git a/custom_components/mega/sensor.py b/custom_components/mega/sensor.py index 3528149..5486928 100644 --- a/custom_components/mega/sensor.py +++ b/custom_components/mega/sensor.py @@ -1,4 +1,5 @@ """Platform for light integration.""" +import asyncio import logging import voluptuous as vol @@ -111,7 +112,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn async_add_devices(devices) - await scan() + asyncio.create_task(scan()) class Mega1WSensor(BaseMegaEntity):