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

This commit is contained in:
Andre Lengwenus authored and Paulus Schoutsen committed 2019-04-23 19:20:20 -07:00
1 parent aa26f90420
commit 662375bdd7
6 files changed
+32 -44

No files matched your search

+8 -11
View File
@@ -1,4 +1,6 @@
"""Support for LCN binary sensors."""
import pypck
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import CONF_ADDRESS
@@ -13,8 +15,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]
@@ -50,9 +50,8 @@ class LcnRegulatorLockSensor(LcnDevice, BinarySensorDevice):
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.setpoint_variable))
await self.address_connection.activate_status_request_handler(
self.setpoint_variable)
@property
def is_on(self):
@@ -84,9 +83,8 @@ class LcnBinarySensor(LcnDevice, BinarySensorDevice):
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.bin_sensor_port))
await self.address_connection.activate_status_request_handler(
self.bin_sensor_port)
@property
def is_on(self):
@@ -115,9 +113,8 @@ class LcnLockKeysSensor(LcnDevice, BinarySensorDevice):
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.source))
await self.address_connection.activate_status_request_handler(
self.source)
@property
def is_on(self):