Update docstrings (#7361)

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update docstrings

* Update tomato.py

* Update isy994.py

* Lint + fix tests

* Lint
This commit is contained in:
Fabian Affolter authored and Paulus Schoutsen committed 2017-04-29 22:04:49 -07:00
1 parent e22e70a01a
commit 3ee4d1060f
264 files changed
+1686 -1768

No files matched your search

+2 -2
View File
@@ -22,11 +22,11 @@ from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.config_validation import PLATFORM_SCHEMA # noqa
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
DOMAIN = 'fan'
SCAN_INTERVAL = timedelta(seconds=30)
_LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelta(seconds=30)
GROUP_NAME_ALL_FANS = 'all fans'
ENTITY_ID_ALL_FANS = group.ENTITY_ID_FORMAT.format(GROUP_NAME_ALL_FANS)
+1 -3
View File
@@ -4,13 +4,11 @@ Demo fan platform that has a fake fan.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
from homeassistant.components.fan import (SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH,
FanEntity, SUPPORT_SET_SPEED,
SUPPORT_OSCILLATE, SUPPORT_DIRECTION)
from homeassistant.const import STATE_OFF
FAN_NAME = 'Living Room Fan'
FAN_ENTITY_ID = 'fan.living_room_fan'
@@ -19,7 +17,7 @@ DEMO_SUPPORT = SUPPORT_SET_SPEED | SUPPORT_OSCILLATE | SUPPORT_DIRECTION
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
"""Setup demo fan platform."""
"""Set up the demo fan platform."""
add_devices_callback([
DemoFan(hass, FAN_NAME, STATE_OFF),
])
+5 -5
View File
@@ -37,7 +37,7 @@ def setup_platform(hass, config: ConfigType,
add_devices: Callable[[list], None], discovery_info=None):
"""Setup the ISY994 fan platform."""
if isy.ISY is None or not isy.ISY.connected:
_LOGGER.error('A connection has not been made to the ISY controller.')
_LOGGER.error("A connection has not been made to the ISY controller")
return False
devices = []
@@ -78,7 +78,7 @@ class ISYFanDevice(isy.ISYDevice, FanEntity):
def set_speed(self, speed: str) -> None:
"""Send the set speed command to the ISY994 fan device."""
if not self._node.on(val=STATE_TO_VALUE.get(speed, 0)):
_LOGGER.debug('Unable to set fan speed')
_LOGGER.debug("Unable to set fan speed")
else:
self.speed = self.state
@@ -89,7 +89,7 @@ class ISYFanDevice(isy.ISYDevice, FanEntity):
def turn_off(self, **kwargs) -> None:
"""Send the turn off command to the ISY994 fan device."""
if not self._node.off():
_LOGGER.debug('Unable to set fan speed')
_LOGGER.debug("Unable to set fan speed")
else:
self.speed = self.state
@@ -112,13 +112,13 @@ class ISYFanProgram(ISYFanDevice):
def turn_off(self, **kwargs) -> None:
"""Send the turn on command to ISY994 fan program."""
if not self._actions.runThen():
_LOGGER.error('Unable to open the cover')
_LOGGER.error("Unable to turn off the fan")
else:
self.speed = STATE_ON if self.is_on else STATE_OFF
def turn_on(self, **kwargs) -> None:
"""Send the turn off command to ISY994 fan program."""
if not self._actions.runElse():
_LOGGER.error('Unable to close the cover')
_LOGGER.error("Unable to turn on the fan")
else:
self.speed = STATE_ON if self.is_on else STATE_OFF
+5 -5
View File
@@ -77,7 +77,7 @@ PLATFORM_SCHEMA = mqtt.MQTT_RW_PLATFORM_SCHEMA.extend({
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Setup MQTT fan platform."""
"""Set up the MQTT fan platform."""
async_add_devices([MqttFan(
config.get(CONF_NAME),
{
@@ -140,7 +140,7 @@ class MqttFan(FanEntity):
@asyncio.coroutine
def async_added_to_hass(self):
"""Subscribe mqtt events.
"""Subscribe to MQTT events.
This method is a coroutine.
"""
@@ -154,7 +154,7 @@ class MqttFan(FanEntity):
@callback
def state_received(topic, payload, qos):
"""A new MQTT message has been received."""
"""Handle new received MQTT message."""
payload = templates[CONF_STATE](payload)
if payload == self._payload[STATE_ON]:
self._state = True
@@ -169,7 +169,7 @@ class MqttFan(FanEntity):
@callback
def speed_received(topic, payload, qos):
"""A new MQTT message for the speed has been received."""
"""Handle new received MQTT message for the speed."""
payload = templates[ATTR_SPEED](payload)
if payload == self._payload[SPEED_LOW]:
self._speed = SPEED_LOW
@@ -187,7 +187,7 @@ class MqttFan(FanEntity):
@callback
def oscillation_received(topic, payload, qos):
"""A new MQTT message has been received."""
"""Handle new received MQTT message for the oscillation."""
payload = templates[OSCILLATION](payload)
if payload == self._payload[OSCILLATE_ON_PAYLOAD]:
self._oscillation = True
+2 -2
View File
@@ -14,8 +14,8 @@ from homeassistant.components.wink import WinkDevice, DOMAIN
_LOGGER = logging.getLogger(__name__)
SPEED_LOWEST = "lowest"
SPEED_AUTO = "auto"
SPEED_LOWEST = 'lowest'
SPEED_AUTO = 'auto'
def setup_platform(hass, config, add_devices, discovery_info=None):