32166fd56ae076634316dc7a6c60c067f86f7604,homeassistant/components/switch/insteon_plm.py,,async_setup_platform,#Any#Any#Any#Any#,20

Before Change


    Set up the INSTEON PLM device class for the hass platform.
    plm = hass.data["insteon_plm"]

    device_list = []
    for device in discovery_info:
        name = device.get("address")
        address = device.get("address_hex")

        _LOGGER.info("Registered %s with switch platform.", name)

        device_list.append(
            InsteonPLMSwitchDevice(hass, plm, address, name)
        )

    async_add_devices(device_list)


class InsteonPLMSwitchDevice(SwitchDevice):
    A Class for an Insteon device.

After Change


    Set up the INSTEON PLM device class for the hass platform.
    plm = hass.data["insteon_plm"]

    address = discovery_info["address"]
    device = plm.devices[address]
    state_key = discovery_info["state_key"]

    state_name = device.states[state_key].name

    _LOGGER.debug("Adding device %s entity %s to Switch platform",
                  device.address.hex, device.states[state_key].name)

    new_entity = None
    if state_name in ["lightOnOff", "outletTopOnOff", "outletBottomOnOff"]:
        new_entity = InsteonPLMSwitchDevice(device, state_key)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 25

Instances


Project Name: home-assistant/home-assistant
Commit Name: 32166fd56ae076634316dc7a6c60c067f86f7604
Time: 2018-02-25
Author: tharris@harrisnj.net
File Name: homeassistant/components/switch/insteon_plm.py
Class Name:
Method Name: async_setup_platform


Project Name: home-assistant/home-assistant
Commit Name: 32166fd56ae076634316dc7a6c60c067f86f7604
Time: 2018-02-25
Author: tharris@harrisnj.net
File Name: homeassistant/components/binary_sensor/insteon_plm.py
Class Name:
Method Name: async_setup_platform


Project Name: home-assistant/home-assistant
Commit Name: 32166fd56ae076634316dc7a6c60c067f86f7604
Time: 2018-02-25
Author: tharris@harrisnj.net
File Name: homeassistant/components/light/insteon_plm.py
Class Name:
Method Name: async_setup_platform


Project Name: home-assistant/home-assistant
Commit Name: 32166fd56ae076634316dc7a6c60c067f86f7604
Time: 2018-02-25
Author: tharris@harrisnj.net
File Name: homeassistant/components/switch/insteon_plm.py
Class Name:
Method Name: async_setup_platform