Cleanup of knx component (#12408)

This commit is contained in:
Julius Mittenzwei authored and Paulus Schoutsen committed 2018-02-14 22:10:12 -08:00
1 parent f5d1f53fab
commit ae32d208d9
8 files changed
+3 -28

No files matched your search

@@ -56,9 +56,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up binary sensor(s) for KNX platform.""" """Set up binary sensor(s) for KNX platform."""
if DATA_KNX not in hass.data or not hass.data[DATA_KNX].initialized:
return
if discovery_info is not None: if discovery_info is not None:
async_add_devices_discovery(hass, discovery_info, async_add_devices) async_add_devices_discovery(hass, discovery_info, async_add_devices)
else: else:
-3
View File
@@ -64,9 +64,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up climate(s) for KNX platform.""" """Set up climate(s) for KNX platform."""
if DATA_KNX not in hass.data or not hass.data[DATA_KNX].initialized:
return
if discovery_info is not None: if discovery_info is not None:
async_add_devices_discovery(hass, discovery_info, async_add_devices) async_add_devices_discovery(hass, discovery_info, async_add_devices)
else: else:
-3
View File
@@ -53,9 +53,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up cover(s) for KNX platform.""" """Set up cover(s) for KNX platform."""
if DATA_KNX not in hass.data or not hass.data[DATA_KNX].initialized:
return
if discovery_info is not None: if discovery_info is not None:
async_add_devices_discovery(hass, discovery_info, async_add_devices) async_add_devices_discovery(hass, discovery_info, async_add_devices)
else: else:
-1
View File
@@ -120,7 +120,6 @@ class KNXModule(object):
self.hass = hass self.hass = hass
self.config = config self.config = config
self.connected = False self.connected = False
self.initialized = True
self.init_xknx() self.init_xknx()
self.register_callbacks() self.register_callbacks()
-4
View File
@@ -40,10 +40,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up lights for KNX platform.""" """Set up lights for KNX platform."""
if DATA_KNX not in hass.data \
or not hass.data[DATA_KNX].initialized:
return
if discovery_info is not None: if discovery_info is not None:
async_add_devices_discovery(hass, discovery_info, async_add_devices) async_add_devices_discovery(hass, discovery_info, async_add_devices)
else: else:
+3 -8
View File
@@ -27,10 +27,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine @asyncio.coroutine
def async_get_service(hass, config, discovery_info=None): def async_get_service(hass, config, discovery_info=None):
"""Get the KNX notification service.""" """Get the KNX notification service."""
if DATA_KNX not in hass.data \
or not hass.data[DATA_KNX].initialized:
return False
return async_get_service_discovery(hass, discovery_info) \ return async_get_service_discovery(hass, discovery_info) \
if discovery_info is not None else \ if discovery_info is not None else \
async_get_service_config(hass, config) async_get_service_config(hass, config)
@@ -44,7 +40,7 @@ def async_get_service_discovery(hass, discovery_info):
device = hass.data[DATA_KNX].xknx.devices[device_name] device = hass.data[DATA_KNX].xknx.devices[device_name]
notification_devices.append(device) notification_devices.append(device)
return \ return \
KNXNotificationService(hass, notification_devices) \ KNXNotificationService(notification_devices) \
if notification_devices else \ if notification_devices else \
None None
@@ -58,15 +54,14 @@ def async_get_service_config(hass, config):
name=config.get(CONF_NAME), name=config.get(CONF_NAME),
group_address=config.get(CONF_ADDRESS)) group_address=config.get(CONF_ADDRESS))
hass.data[DATA_KNX].xknx.devices.add(notification) hass.data[DATA_KNX].xknx.devices.add(notification)
return KNXNotificationService(hass, [notification, ]) return KNXNotificationService([notification, ])
class KNXNotificationService(BaseNotificationService): class KNXNotificationService(BaseNotificationService):
"""Implement demo notification service.""" """Implement demo notification service."""
def __init__(self, hass, devices): def __init__(self, devices):
"""Initialize the service.""" """Initialize the service."""
self.hass = hass
self.devices = devices self.devices = devices
@property @property
-3
View File
@@ -31,9 +31,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up sensor(s) for KNX platform.""" """Set up sensor(s) for KNX platform."""
if DATA_KNX not in hass.data or not hass.data[DATA_KNX].initialized:
return
if discovery_info is not None: if discovery_info is not None:
async_add_devices_discovery(hass, discovery_info, async_add_devices) async_add_devices_discovery(hass, discovery_info, async_add_devices)
else: else:
-3
View File
@@ -30,9 +30,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine @asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up switch(es) for KNX platform.""" """Set up switch(es) for KNX platform."""
if DATA_KNX not in hass.data or not hass.data[DATA_KNX].initialized:
return
if discovery_info is not None: if discovery_info is not None:
async_add_devices_discovery(hass, discovery_info, async_add_devices) async_add_devices_discovery(hass, discovery_info, async_add_devices)
else: else: