1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Update/add docstrings (PEP257)

This commit is contained in:
Fabian Affolter
2016-02-23 06:21:49 +01:00
parent c64da761f1
commit 60d579af84
46 changed files with 407 additions and 510 deletions

View File

@@ -1,6 +1,4 @@
"""
homeassistant.components.sensor.efergy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monitors home energy use as measured by an efergy engage hub using its
(unofficial, undocumented) API.
@@ -23,7 +21,7 @@ SENSOR_TYPES = {
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Efergy sensor. """
"""Sets up the Efergy sensor."""
app_token = config.get("app_token")
if not app_token:
_LOGGER.error(
@@ -48,7 +46,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-many-instance-attributes
class EfergySensor(Entity):
""" Implements an Efergy sensor. """
"""Implements an Efergy sensor."""
# pylint: disable=too-many-arguments
def __init__(self, sensor_type, app_token, utc_offset, period, currency):
@@ -66,21 +64,21 @@ class EfergySensor(Entity):
@property
def name(self):
""" Returns the name. """
"""Returns the name of the sensor."""
return self._name
@property
def state(self):
""" Returns the state of the device. """
"""Returns the state of the sensor."""
return self._state
@property
def unit_of_measurement(self):
""" Unit of measurement of this entity, if any. """
"""Unit of measurement of this entity, if any."""
return self._unit_of_measurement
def update(self):
""" Gets the Efergy monitor data from the web service. """
"""Gets the Efergy monitor data from the web service."""
try:
if self.type == 'instant_readings':
url_string = _RESOURCE + 'getInstant?token=' + self.app_token