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):