Fix PEPE257 issues
This commit is contained in:
1 parent
49ebc6d0b0
commit
8bff97083c
49 files changed
+429
-363
No files matched your search
@@ -38,7 +38,7 @@ CONF_VERIFY_TLS = 'verify_tls'
|
||||
|
||||
# pylint: disable=unused-variable
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Sets up mFi sensors."""
|
||||
"""Setup mFi sensors."""
|
||||
if not validate_config({DOMAIN: config},
|
||||
{DOMAIN: ['host',
|
||||
CONF_USERNAME,
|
||||
@@ -71,20 +71,21 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
|
||||
|
||||
class MfiSensor(Entity):
|
||||
"""An mFi sensor that exposes tag=value."""
|
||||
"""Representation of a mFi sensor."""
|
||||
|
||||
def __init__(self, port, hass):
|
||||
"""Initialize the sensor."""
|
||||
self._port = port
|
||||
self._hass = hass
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Returns the name of th sensor."""
|
||||
"""Return the name of th sensor."""
|
||||
return self._port.label
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Returns the state of the sensor."""
|
||||
"""Return the state of the sensor."""
|
||||
if self._port.model == 'Input Digital':
|
||||
return self._port.value > 0 and STATE_ON or STATE_OFF
|
||||
else:
|
||||
@@ -93,7 +94,7 @@ class MfiSensor(Entity):
|
||||
|
||||
@property
|
||||
def unit_of_measurement(self):
|
||||
"""Unit of measurement of this entity, if any."""
|
||||
"""Return the unit of measurement of this entity, if any."""
|
||||
if self._port.tag == 'temperature':
|
||||
return TEMP_CELCIUS
|
||||
elif self._port.tag == 'active_pwr':
|
||||
@@ -103,5 +104,5 @@ class MfiSensor(Entity):
|
||||
return self._port.tag
|
||||
|
||||
def update(self):
|
||||
"""Gets the latest data."""
|
||||
"""Get the latest data."""
|
||||
self._port.refresh()
|
||||
Reference in new issue
Block a user