789929d4457fd9bff7710d46171000a4b6c4e3aa,homeassistant/components/sensor/hddtemp.py,,setup_platform,#Any#Any#Any#Any#,39

Before Change


        _LOGGER.error("Unable to fetch the data from %s:%s", host, port)
        return False

    add_devices([HddTempSensor(name, hddtemp)], True)


class HddTempSensor(Entity):
    Representation of a HDDTemp sensor.

After Change


    name = config.get(CONF_NAME)
    host = config.get(CONF_HOST)
    port = config.get(CONF_PORT)
    disks = config.get(CONF_DISKS)

    try:
        hddtemp = HddTempData(host, port)
        hddtemp.update()
    except RuntimeError:
        _LOGGER.error("Unable to fetch the data from %s:%s", host, port)
        return False

    if not disks:
        disks = [next(iter(hddtemp.data)).split("|")[0]]

    dev = []
    for disk in disks:
        if disk in hddtemp.data:
            dev.append(HddTempSensor(name, disk, hddtemp))
        else:
            continue

    add_devices(dev, True)


class HddTempSensor(Entity):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: home-assistant/home-assistant
Commit Name: 789929d4457fd9bff7710d46171000a4b6c4e3aa
Time: 2017-10-21
Author: cgtobi@users.noreply.github.com
File Name: homeassistant/components/sensor/hddtemp.py
Class Name:
Method Name: setup_platform


Project Name: home-assistant/home-assistant
Commit Name: 10a2ecd1d61ae3d2355301096ba096dcf3e065ab
Time: 2018-08-14
Author: mail@fabian-affolter.ch
File Name: homeassistant/components/sensor/worldtidesinfo.py
Class Name:
Method Name: setup_platform


Project Name: home-assistant/home-assistant
Commit Name: 8703124c760df303d29571aa975a72cc4f868f09
Time: 2018-01-17
Author: pierre.staahl@gmail.com
File Name: homeassistant/components/media_player/yamaha.py
Class Name:
Method Name: setup_platform