mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
respect pylint suggestions
This commit is contained in:
parent
3829abbd2d
commit
3027b4a5a8
@ -19,7 +19,9 @@ 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 dtoverlay=w1-gpio,gpiopin=4 is in your /boot/config.txt and the correct gpiopin number is set.')
|
_LOGGER.error('No onewire sensor found. Check if
|
||||||
|
dtoverlay=w1-gpio,gpiopin=4 is in your /boot/config.txt
|
||||||
|
and the correct gpiopin number is set.')
|
||||||
return
|
return
|
||||||
|
|
||||||
devs = []
|
devs = []
|
||||||
@ -36,7 +38,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
## 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 = [config['names'].get(sensor_id, sensor_id) for sensor_id in SENSOR_IDS]
|
||||||
|
|
||||||
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)
|
||||||
@ -50,9 +51,10 @@ class OneWire(Entity):
|
|||||||
self._unit_of_measurement = unit_of_measurement
|
self._unit_of_measurement = unit_of_measurement
|
||||||
|
|
||||||
def _read_temp_raw(self):
|
def _read_temp_raw(self):
|
||||||
f = open(self._device_file, 'r')
|
""" read the temperature as it is returned by the sensor"""
|
||||||
lines = f.readlines()
|
ds_device_file = open(self._device_file, 'r')
|
||||||
f.close()
|
lines = ds_device_file.readlines()
|
||||||
|
ds_device_file.close()
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -81,4 +83,3 @@ class OneWire(Entity):
|
|||||||
@property
|
@property
|
||||||
def unit_of_measurement(self):
|
def unit_of_measurement(self):
|
||||||
return self._unit_of_measurement
|
return self._unit_of_measurement
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user