Revert "renamed add_devices to async_add_devices according to hass naming scheme (#9485)" (#9503)

This reverts commit a5a970709f.
This commit is contained in:
Pascal Vizeli authored and GitHub committed 2017-09-19 19:51:15 +02:00
1 parent a5a970709f
commit 1bbaa00976
12 files changed
+57 -55

No files matched your search

+7 -7
View File
@@ -32,7 +32,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices,
def async_setup_platform(hass, config, add_devices,
discovery_info=None):
"""Set up light(s) for KNX platform."""
if DATA_KNX not in hass.data \
@@ -40,25 +40,25 @@ def async_setup_platform(hass, config, async_add_devices,
return False
if discovery_info is not None:
async_add_devices_discovery(hass, discovery_info, async_add_devices)
async_add_devices_discovery(hass, discovery_info, add_devices)
else:
async_add_devices_config(hass, config, async_add_devices)
async_add_devices_config(hass, config, add_devices)
return True
@callback
def async_add_devices_discovery(hass, discovery_info, async_add_devices):
def async_add_devices_discovery(hass, discovery_info, add_devices):
"""Set up lights for KNX platform configured via xknx.yaml."""
entities = []
for device_name in discovery_info[ATTR_DISCOVER_DEVICES]:
device = hass.data[DATA_KNX].xknx.devices[device_name]
entities.append(KNXLight(hass, device))
async_add_devices(entities)
add_devices(entities)
@callback
def async_add_devices_config(hass, config, async_add_devices):
def async_add_devices_config(hass, config, add_devices):
"""Set up light for KNX platform configured within plattform."""
import xknx
light = xknx.devices.Light(
@@ -70,7 +70,7 @@ def async_add_devices_config(hass, config, async_add_devices):
group_address_brightness_state=config.get(
CONF_BRIGHTNESS_STATE_ADDRESS))
hass.data[DATA_KNX].xknx.devices.add(light)
async_add_devices([KNXLight(hass, light)])
add_devices([KNXLight(hass, light)])
class KNXLight(Light):