Config flow tradfri (#16665)

* Fix comments

* Add config flow tests

* Fix Tradfri light tests

* Lint

* Remove import group from config flow

* fix stale comments
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2018-09-19 21:21:43 +02:00
1 parent 3160fa5de8
commit a1c524d372
13 files changed
+519 -262

No files matched your search

+6 -12
View File
@@ -19,20 +19,14 @@ DEPENDENCIES = ['tradfri']
SCAN_INTERVAL = timedelta(minutes=5)
async def async_setup_platform(hass, config, async_add_entities,
discovery_info=None):
"""Set up the IKEA Tradfri device platform."""
if discovery_info is None:
return
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up a Tradfri config entry."""
api = hass.data[KEY_API][config_entry.entry_id]
gateway = hass.data[KEY_GATEWAY][config_entry.entry_id]
gateway_id = discovery_info['gateway']
api = hass.data[KEY_API][gateway_id]
gateway = hass.data[KEY_GATEWAY][gateway_id]
devices_command = gateway.get_devices()
devices_commands = await api(devices_command)
devices_commands = await api(gateway.get_devices())
all_devices = await api(devices_commands)
devices = [dev for dev in all_devices if not dev.has_light_control]
devices = (dev for dev in all_devices if not dev.has_light_control)
async_add_entities(TradfriDevice(device, api) for device in devices)