Changes due to manifest.json. Awaiting coroutines instead of creating tasks (#23321)
parent
aa26f90420
commit
662375bdd7
|
@ -1,6 +1,8 @@
|
|||
"""Support for LCN devices."""
|
||||
import logging
|
||||
|
||||
import pypck
|
||||
from pypck.connection import PchkConnectionManager
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
|
@ -149,9 +151,6 @@ def get_connection(connections, connection_id=None):
|
|||
|
||||
async def async_setup(hass, config):
|
||||
"""Set up the LCN component."""
|
||||
import pypck
|
||||
from pypck.connection import PchkConnectionManager
|
||||
|
||||
hass.data[DATA_LCN] = {}
|
||||
|
||||
conf_connections = config[DOMAIN][CONF_CONNECTIONS]
|
||||
|
@ -201,7 +200,6 @@ class LcnDevice(Entity):
|
|||
|
||||
def __init__(self, config, address_connection):
|
||||
"""Initialize the LCN device."""
|
||||
import pypck
|
||||
self.pypck = pypck
|
||||
self.config = config
|
||||
self.address_connection = address_connection
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for LCN covers."""
|
||||
import pypck
|
||||
|
||||
from homeassistant.components.cover import CoverDevice
|
||||
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]
|
||||
|
@ -43,9 +43,8 @@ class LcnCover(LcnDevice, CoverDevice):
|
|||
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.motor))
|
||||
await self.address_connection.activate_status_request_handler(
|
||||
self.motor)
|
||||
|
||||
@property
|
||||
def is_closed(self):
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for LCN lights."""
|
||||
import pypck
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS, ATTR_TRANSITION, SUPPORT_BRIGHTNESS, SUPPORT_TRANSITION,
|
||||
Light)
|
||||
|
@ -16,8 +18,6 @@ async def async_setup_platform(
|
|||
if discovery_info is None:
|
||||
return
|
||||
|
||||
import pypck
|
||||
|
||||
devices = []
|
||||
for config in discovery_info:
|
||||
address, connection_id = config[CONF_ADDRESS]
|
||||
|
@ -56,9 +56,8 @@ class LcnOutputLight(LcnDevice, Light):
|
|||
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 supported_features(self):
|
||||
|
@ -138,9 +137,8 @@ class LcnRelayLight(LcnDevice, Light):
|
|||
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):
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
"""Support for LCN sensors."""
|
||||
import pypck
|
||||
|
||||
from homeassistant.const import CONF_ADDRESS, CONF_UNIT_OF_MEASUREMENT
|
||||
|
||||
from . import LcnDevice, get_connection
|
||||
|
@ -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 LcnVariableSensor(LcnDevice):
|
|||
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.variable))
|
||||
await self.address_connection.activate_status_request_handler(
|
||||
self.variable)
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
|
@ -91,9 +90,8 @@ class LcnLedLogicSensor(LcnDevice):
|
|||
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 state(self):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue