deecec5e4e7c4585c544b2fc89ed1e841d675ed7,homeassistant/components/switch/mqtt.py,,setup_platform,#Any#Any#Any#Any#,28

Before Change


// pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
    Add MQTT switch.
    if config.get("command_topic") is None:
        _LOGGER.error("Missing required variable: command_topic")
        return False

    add_devices_callback([MqttSwitch(
        hass,
        convert(config.get("name"), str, DEFAULT_NAME),
        config.get("state_topic"),
        config.get("command_topic"),
        convert(config.get("qos"), int, DEFAULT_QOS),
        convert(config.get("retain"), bool, DEFAULT_RETAIN),
        convert(config.get("payload_on"), str, DEFAULT_PAYLOAD_ON),
        convert(config.get("payload_off"), str, DEFAULT_PAYLOAD_OFF),
        convert(config.get("optimistic"), bool, DEFAULT_OPTIMISTIC),
        config.get(CONF_VALUE_TEMPLATE))])


// pylint: disable=too-many-arguments, too-many-instance-attributes

After Change


// pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
    Add MQTT switch.
    add_devices_callback([MqttSwitch(
        hass,
        config[CONF_NAME],
        config.get(CONF_STATE_TOPIC),
        config[CONF_COMMAND_TOPIC],
        config[mqtt.CONF_QOS],
        config[CONF_RETAIN],
        config[CONF_PAYLOAD_ON],
        config[CONF_PAYLOAD_OFF],
        config[CONF_OPTIMISTIC],
        config.get(CONF_VALUE_TEMPLATE))])


// pylint: disable=too-many-arguments, too-many-instance-attributes
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 21

Instances


Project Name: home-assistant/home-assistant
Commit Name: deecec5e4e7c4585c544b2fc89ed1e841d675ed7
Time: 2016-04-06
Author: jaharkes@cs.cmu.edu
File Name: homeassistant/components/switch/mqtt.py
Class Name:
Method Name: setup_platform


Project Name: home-assistant/home-assistant
Commit Name: c8df06bb9f1bddec6022b56d99e8768a5bb98a00
Time: 2016-04-06
Author: jaharkes@cs.cmu.edu
File Name: homeassistant/components/lock/mqtt.py
Class Name:
Method Name: setup_platform


Project Name: home-assistant/home-assistant
Commit Name: deecec5e4e7c4585c544b2fc89ed1e841d675ed7
Time: 2016-04-06
Author: jaharkes@cs.cmu.edu
File Name: homeassistant/components/switch/mqtt.py
Class Name:
Method Name: setup_platform


Project Name: home-assistant/home-assistant
Commit Name: 0bd4e15fcb6fb652e19b90d7fbc47b2be37d1172
Time: 2016-04-06
Author: jaharkes@cs.cmu.edu
File Name: homeassistant/components/alarm_control_panel/mqtt.py
Class Name:
Method Name: setup_platform