Fix PEPE257 issues

This commit is contained in:
Fabian Affolter 2016-03-08 16:46:34 +01:00
parent 49ebc6d0b0
commit 8bff97083c
49 changed files with 429 additions and 363 deletions

View file

@ -21,8 +21,7 @@ DEPENDENCIES = ['mqtt']
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
"""Add MQTT Sensor."""
"""Setup MQTT Sensor."""
if config.get('state_topic') is None:
_LOGGER.error("Missing required variable: state_topic")
return False
@ -38,9 +37,11 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
# pylint: disable=too-many-arguments, too-many-instance-attributes
class MqttSensor(Entity):
"""Represents a sensor that can be updated using MQTT."""
"""Representation of a sensor that can be updated using MQTT."""
def __init__(self, hass, name, state_topic, qos, unit_of_measurement,
value_template):
"""Initialize the sensor."""
self._state = STATE_UNKNOWN
self._hass = hass
self._name = name
@ -65,15 +66,15 @@ class MqttSensor(Entity):
@property
def name(self):
"""The name of the sensor."""
"""Return the name of the sensor."""
return self._name
@property
def unit_of_measurement(self):
"""Unit this state is expressed in."""
"""Return the unit this state is expressed in."""
return self._unit_of_measurement
@property
def state(self):
"""Returns the state of the entity."""
"""Return the state of the entity."""
return self._state