1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Changes due to manifest.json. Awaiting coroutines instead of creating tasks (#23321)

This commit is contained in:
Andre Lengwenus
2019-04-24 04:20:20 +02:00
committed by Paulus Schoutsen
parent aa26f90420
commit 662375bdd7
6 changed files with 32 additions and 44 deletions

View File

@@ -1,4 +1,6 @@
"""Support for LCN switches."""
import pypck
from homeassistant.components.switch import SwitchDevice
from homeassistant.const import CONF_ADDRESS
@@ -12,8 +14,6 @@ async def async_setup_platform(hass, hass_config, async_add_entities,
if discovery_info is None:
return
import pypck
devices = []
for config in discovery_info:
address, connection_id = config[CONF_ADDRESS]
@@ -46,9 +46,8 @@ class LcnOutputSwitch(LcnDevice, SwitchDevice):
async def async_added_to_hass(self):
"""Run when entity about to be added to hass."""
await super().async_added_to_hass()
self.hass.async_create_task(
self.address_connection.activate_status_request_handler(
self.output))
await self.address_connection.activate_status_request_handler(
self.output)
@property
def is_on(self):
@@ -91,9 +90,8 @@ class LcnRelaySwitch(LcnDevice, SwitchDevice):
async def async_added_to_hass(self):
"""Run when entity about to be added to hass."""
await super().async_added_to_hass()
self.hass.async_create_task(
self.address_connection.activate_status_request_handler(
self.output))
await self.address_connection.activate_status_request_handler(
self.output)
@property
def is_on(self):