Add link to docs and modify docstrings to match PEP257
This commit is contained in:
parent
3f82b9d6b0
commit
4563c54a3e
13 changed files with 155 additions and 152 deletions
|
@ -1,7 +1,8 @@
|
|||
"""
|
||||
homeassistant.components.rollershutter.demo
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Demo platform for the rollorshutter component.
|
||||
Demo platform for the rollor shutter component.
|
||||
|
||||
For more details about this platform, please refer to the documentation
|
||||
https://home-assistant.io/components/demo/
|
||||
"""
|
||||
from homeassistant.components.rollershutter import RollershutterDevice
|
||||
from homeassistant.const import EVENT_TIME_CHANGED
|
||||
|
@ -9,7 +10,7 @@ from homeassistant.helpers.event import track_utc_time_change
|
|||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
""" Sets up the Demo rollershutters. """
|
||||
"""Setup the Demo roller shutters."""
|
||||
add_devices([
|
||||
DemoRollershutter(hass, 'Kitchen Window', 0),
|
||||
DemoRollershutter(hass, 'Living Room Window', 100),
|
||||
|
@ -17,9 +18,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
|
||||
|
||||
class DemoRollershutter(RollershutterDevice):
|
||||
""" Represents a rollershutter.. """
|
||||
"""Represents a roller shutter."""
|
||||
# pylint: disable=no-self-use
|
||||
|
||||
def __init__(self, hass, name, position):
|
||||
self.hass = hass
|
||||
self._name = name
|
||||
|
@ -29,21 +29,21 @@ class DemoRollershutter(RollershutterDevice):
|
|||
|
||||
@property
|
||||
def name(self):
|
||||
""" Returns the name of the rollershutter. """
|
||||
"""Returns the name of the roller shutter."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
""" No polling needed for a demo rollershutter. """
|
||||
"""No polling needed for a demo roller shutter."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def current_position(self):
|
||||
""" Returns the current position of the rollershutter. """
|
||||
"""Return the current position of the roller shutter."""
|
||||
return self._position
|
||||
|
||||
def move_up(self, **kwargs):
|
||||
""" Move the rollershutter down. """
|
||||
"""Move the roller shutter down."""
|
||||
if self._position == 0:
|
||||
return
|
||||
|
||||
|
@ -51,7 +51,7 @@ class DemoRollershutter(RollershutterDevice):
|
|||
self._moving_up = True
|
||||
|
||||
def move_down(self, **kwargs):
|
||||
""" Move the rollershutter up. """
|
||||
"""Move the roller shutter up."""
|
||||
if self._position == 100:
|
||||
return
|
||||
|
||||
|
@ -59,19 +59,19 @@ class DemoRollershutter(RollershutterDevice):
|
|||
self._moving_up = False
|
||||
|
||||
def stop(self, **kwargs):
|
||||
""" Stop the rollershutter. """
|
||||
"""Stops the roller shutter."""
|
||||
if self._listener is not None:
|
||||
self.hass.bus.remove_listener(EVENT_TIME_CHANGED, self._listener)
|
||||
self._listener = None
|
||||
|
||||
def _listen(self):
|
||||
""" Listens for changes. """
|
||||
"""Listen for changes."""
|
||||
if self._listener is None:
|
||||
self._listener = track_utc_time_change(self.hass,
|
||||
self._time_changed)
|
||||
|
||||
def _time_changed(self, now):
|
||||
""" Track time changes. """
|
||||
"""Track time changes."""
|
||||
if self._moving_up:
|
||||
self._position -= 10
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue