Fix PEPE257 issues
This commit is contained in:
1 parent
49ebc6d0b0
commit
8bff97083c
49 files changed
+429
-363
No files matched your search
@@ -28,7 +28,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=30)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Get the DHT sensor."""
|
||||
"""Setup the DHT sensor."""
|
||||
# pylint: disable=import-error
|
||||
import Adafruit_DHT
|
||||
|
||||
@@ -67,8 +67,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class DHTSensor(Entity):
|
||||
"""Implements an DHT sensor."""
|
||||
"""Implementation of the DHT sensor."""
|
||||
|
||||
def __init__(self, dht_client, sensor_type, temp_unit, name):
|
||||
"""Initialize the sensor."""
|
||||
self.client_name = name
|
||||
self._name = SENSOR_TYPES[sensor_type][0]
|
||||
self.dht_client = dht_client
|
||||
@@ -80,21 +82,21 @@ class DHTSensor(Entity):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Returns the name of the sensor."""
|
||||
"""Return the name of the sensor."""
|
||||
return '{} {}'.format(self.client_name, self._name)
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Returns the state of the sensor."""
|
||||
"""Return the state of the sensor."""
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
"""Unit of measurement of this entity, if any."""
|
||||
"""Return the unit of measurement of this entity, if any."""
|
||||
return self._unit_of_measurement
|
||||
|
||||
def update(self):
|
||||
"""Gets the latest data from the DHT and updates the states."""
|
||||
"""Get the latest data from the DHT and updates the states."""
|
||||
self.dht_client.update()
|
||||
data = self.dht_client.data
|
||||
|
||||
@@ -107,8 +109,10 @@ class DHTSensor(Entity):
|
||||
|
||||
|
||||
class DHTClient(object):
|
||||
"""Gets the latest data from the DHT sensor."""
|
||||
"""Get the latest data from the DHT sensor."""
|
||||
|
||||
def __init__(self, adafruit_dht, sensor, pin):
|
||||
"""Initialize the sensor."""
|
||||
self.adafruit_dht = adafruit_dht
|
||||
self.sensor = sensor
|
||||
self.pin = pin
|
||||
@@ -116,7 +120,7 @@ class DHTClient(object):
|
||||
|
||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
def update(self):
|
||||
"""Gets the latest data the DHT sensor."""
|
||||
"""Get the latest data the DHT sensor."""
|
||||
humidity, temperature = self.adafruit_dht.read_retry(self.sensor,
|
||||
self.pin)
|
||||
if temperature:
|
||||
|
||||
Reference in new issue
Block a user