cce3e284d735ad2b4c71c4100bf7ce924cbf0c7f,homeassistant/components/sensor/neurio_energy.py,,setup_platform,#Any#Any#Any#Any#,20

Before Change


        _LOGGER.warning("Sensor ID auto-detected, set api_sensor_id: "%s"",
                        user_info["locations"][0]["sensors"][0]["sensorId"])
        sensor_id = user_info["locations"][0]["sensors"][0]["sensorId"]
    dev = []
    dev.append(NeurioEnergy(api_key, api_secret, sensor_id))
    add_devices(dev)


// pylint: disable=too-many-instance-attributes
class NeurioEnergy(Entity):

After Change



def setup_platform(hass, config, add_devices, discovery_info=None):
    Setup the Neurio sensor.
    name = config.get(CONF_NAME)
    api_key = config.get(CONF_API_KEY)
    api_secret = config.get(CONF_API_SECRET)
    sensor_id = config.get(CONF_SENSOR_ID)

    if not sensor_id:
        import neurio
        neurio_tp = neurio.TokenProvider(key=api_key, secret=api_secret)
        neurio_client = neurio.Client(token_provider=neurio_tp)
        user_info = neurio_client.get_user_information()
        _LOGGER.warning("Sensor ID auto-detected, set api_sensor_id: "%s"",
                        user_info["locations"][0]["sensors"][0]["sensorId"])
        sensor_id = user_info["locations"][0]["sensors"][0]["sensorId"]

    add_devices([NeurioEnergy(api_key, api_secret, name, sensor_id)])


// pylint: disable=too-many-instance-attributes
class NeurioEnergy(Entity):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: home-assistant/home-assistant
Commit Name: cce3e284d735ad2b4c71c4100bf7ce924cbf0c7f
Time: 2016-09-11
Author: mail@fabian-affolter.ch
File Name: homeassistant/components/sensor/neurio_energy.py
Class Name:
Method Name: setup_platform


Project Name: home-assistant/home-assistant
Commit Name: 0abc50e84458c9ed490c61a74dcce9c4085ae7f1
Time: 2016-08-19
Author: mail@fabian-affolter.ch
File Name: homeassistant/components/sensor/swiss_public_transport.py
Class Name:
Method Name: setup_platform


Project Name: home-assistant/home-assistant
Commit Name: cd67368bb75f8b174b17649c3df37bb75a75bc3b
Time: 2016-09-04
Author: mail@fabian-affolter.ch
File Name: homeassistant/components/sensor/gtfs.py
Class Name:
Method Name: setup_platform