903cda08b153400849409c253cbc8051af53a503,homeassistant/components/light/insteon_local.py,,setup_platform,#Any#Any#Any#Any#,30

Before Change


    insteonhub = hass.data["insteon_local"]

    conf_lights = load_json(hass.config.path(INSTEON_LOCAL_LIGHTS_CONF))
    if conf_lights:
        for device_id in conf_lights:
            setup_light(device_id, conf_lights[device_id], insteonhub, hass,
                        add_devices)

    else:
        linked = insteonhub.get_linked()

        for device_id in linked:
            if (linked[device_id]["cat_type"] == "dimmer" and
                    device_id not in conf_lights):
                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,
                          add_devices_callback):
    Request configuration steps from the user.
    configurator = hass.components.configurator

After Change


def setup_platform(hass, config, add_devices, discovery_info=None):
    Set up the Insteon local light platform.
    insteonhub = hass.data["insteon_local"]
    if discovery_info is None:
        return

    linked = discovery_info["linked"]
    device_list = []
    for device_id in linked:
        if linked[device_id]["cat_type"] == "dimmer":
            device = insteonhub.dimmer(device_id)
            device_list.append(
                InsteonLocalDimmerDevice(device)
            )

    add_devices(device_list)


class InsteonLocalDimmerDevice(Light):
    An abstract Class for an Insteon node.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: home-assistant/home-assistant
Commit Name: 903cda08b153400849409c253cbc8051af53a503
Time: 2018-01-08
Author: cameron.b.llewellyn@gmail.com
File Name: homeassistant/components/light/insteon_local.py
Class Name:
Method Name: setup_platform


Project Name: home-assistant/home-assistant
Commit Name: 903cda08b153400849409c253cbc8051af53a503
Time: 2018-01-08
Author: cameron.b.llewellyn@gmail.com
File Name: homeassistant/components/switch/insteon_local.py
Class Name:
Method Name: setup_platform


Project Name: home-assistant/home-assistant
Commit Name: 1b54218d465827de39f6ca28745fc536ede64278
Time: 2017-02-07
Author: andrey-git@users.noreply.github.com
File Name: homeassistant/components/binary_sensor/zwave.py
Class Name:
Method Name: setup_platform