mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
new try to add everythin from the stylecheckers
This commit is contained in:
parent
d475e5362b
commit
ef76047ba2
@ -23,9 +23,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
""" Sets up the one wire Sensors"""
|
""" Sets up the one wire Sensors"""
|
||||||
|
|
||||||
if DEVICE_FILES == []:
|
if DEVICE_FILES == []:
|
||||||
_LOGGER.error('No onewire sensor found. Check if
|
_LOGGER.error('No onewire sensor found.')
|
||||||
dtoverlay=w1-gpio,gpiopin=4 is in your /boot/config.txt
|
_LOGGER.error('Check if dtoverlay=w1-gpio,gpiopin=4.')
|
||||||
and the correct gpiopin number is set.')
|
_LOGGER.error('is in your /boot/config.txt and')
|
||||||
|
_LOGGER.error('the correct gpiopin number is set.')
|
||||||
return
|
return
|
||||||
|
|
||||||
devs = []
|
devs = []
|
||||||
@ -41,7 +42,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
names = config['names']
|
names = config['names']
|
||||||
# map names to ids.
|
# map names to ids.
|
||||||
elif isinstance(config['names'], dict):
|
elif isinstance(config['names'], dict):
|
||||||
names = [config['names'].get(sensor_id, sensor_id) for sensor_id in SENSOR_IDS]
|
names = []
|
||||||
|
for sensor_id in SENSOR_IDS:
|
||||||
|
names.append(config['names'].get(sensor_id, sensor_id))
|
||||||
for device_file, name in zip(DEVICE_FILES, names):
|
for device_file, name in zip(DEVICE_FILES, names):
|
||||||
devs.append(OneWire(name, device_file, TEMP_CELCIUS))
|
devs.append(OneWire(name, device_file, TEMP_CELCIUS))
|
||||||
add_devices(devs)
|
add_devices(devs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user