Skip to content

Commit 6ede1c0

Browse files
craigjmidwinterballoob
authored andcommitted
Insteon config (home-assistant#5595)
* only check for devices when not defined in config * lint * performance fix
1 parent b4c3de3 commit 6ede1c0

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

homeassistant/components/light/insteon_local.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
3838
setup_light(device_id, conf_lights[device_id], insteonhub, hass,
3939
add_devices)
4040

41-
linked = insteonhub.get_linked()
42-
43-
for device_id in linked:
44-
if (linked[device_id]['cat_type'] == 'dimmer' and
45-
device_id not in conf_lights):
46-
request_configuration(device_id,
47-
insteonhub,
48-
linked[device_id]['model_name'] + ' ' +
49-
linked[device_id]['sku'], hass, add_devices)
41+
else:
42+
linked = insteonhub.get_linked()
43+
44+
for device_id in linked:
45+
if (linked[device_id]['cat_type'] == 'dimmer' and
46+
device_id not in conf_lights):
47+
request_configuration(device_id,
48+
insteonhub,
49+
linked[device_id]['model_name'] + ' ' +
50+
linked[device_id]['sku'],
51+
hass, add_devices)
5052

5153

5254
def request_configuration(device_id, insteonhub, model, hass,

0 commit comments

Comments
 (0)