Skip to content

Commit

Permalink
only check for devices when not defined in config (#5490)
Browse files Browse the repository at this point in the history
* only check for devices when not defined in config

* lint
  • Loading branch information
craigjmidwinter authored and balloob committed Jan 21, 2017
1 parent 74989f7 commit a89a4f3
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions homeassistant/components/switch/insteon_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
INSTEON_LOCAL_SWITCH_CONF = 'insteon_local_switch.conf'

MIN_TIME_BETWEEN_FORCED_SCANS = timedelta(milliseconds=100)
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5)
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)


def setup_platform(hass, config, add_devices, discovery_info=None):
Expand All @@ -36,15 +36,16 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
setup_switch(
device_id, conf_switches[device_id], insteonhub, hass,
add_devices)

linked = insteonhub.get_linked()

for device_id in linked:
if linked[device_id]['cat_type'] == 'switch'\
and device_id not in conf_switches:
request_configuration(device_id, insteonhub,
linked[device_id]['model_name'] + ' ' +
linked[device_id]['sku'], hass, add_devices)
else:
linked = insteonhub.get_linked()

for device_id in linked:
if linked[device_id]['cat_type'] == 'switch'\
and device_id not in conf_switches:
request_configuration(device_id, insteonhub,
linked[device_id]['model_name'] + ' ' +
linked[device_id]['sku'],
hass, add_devices)


def request_configuration(device_id, insteonhub, model, hass,
Expand Down

0 comments on commit a89a4f3

Please sign in to comment.