Add link to docs and modify docstrings to match PEP257
This commit is contained in:
1 parent
3f82b9d6b0
commit
4563c54a3e
13 files changed
+155
-152
No files matched your search
@@ -1,8 +1,8 @@
|
||||
"""
|
||||
homeassistant.components.light.demo
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Demo platform that implements lights.
|
||||
Demo light platform that implements lights.
|
||||
|
||||
For more details about this platform, please refer to the documentation
|
||||
https://home-assistant.io/components/demo/
|
||||
"""
|
||||
import random
|
||||
|
||||
@@ -18,7 +18,7 @@ LIGHT_TEMPS = [240, 380]
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||
""" Find and return demo lights. """
|
||||
"""Setup demo light platform."""
|
||||
add_devices_callback([
|
||||
DemoLight("Bed Light", False),
|
||||
DemoLight("Ceiling Lights", True, LIGHT_COLORS[0], LIGHT_TEMPS[1]),
|
||||
@@ -27,7 +27,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||
|
||||
|
||||
class DemoLight(Light):
|
||||
""" Provides a demo switch. """
|
||||
"""Provides a demo light."""
|
||||
# pylint: disable=too-many-arguments
|
||||
def __init__(self, name, state, rgb=None, ct=None, brightness=180):
|
||||
self._name = name
|
||||
@@ -38,36 +38,36 @@ class DemoLight(Light):
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
""" No polling needed for a demo light. """
|
||||
"""No polling needed for a demo light."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
""" Returns the name of the device if any. """
|
||||
"""Return the name of the light if any."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def brightness(self):
|
||||
""" Brightness of this light between 0..255. """
|
||||
"""Return the brightness of this light between 0..255."""
|
||||
return self._brightness
|
||||
|
||||
@property
|
||||
def rgb_color(self):
|
||||
""" rgb color value. """
|
||||
"""Return the RBG color value."""
|
||||
return self._rgb
|
||||
|
||||
@property
|
||||
def color_temp(self):
|
||||
""" CT color temperature. """
|
||||
"""Return the CT color temperature."""
|
||||
return self._ct
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
""" True if device is on. """
|
||||
"""Return true if light is on."""
|
||||
return self._state
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
""" Turn the device on. """
|
||||
"""Turn the light on."""
|
||||
self._state = True
|
||||
|
||||
if ATTR_RGB_COLOR in kwargs:
|
||||
@@ -82,6 +82,6 @@ class DemoLight(Light):
|
||||
self.update_ha_state()
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
""" Turn the device off. """
|
||||
"""Turn the light off."""
|
||||
self._state = False
|
||||
self.update_ha_state()
|
||||
Reference in new issue
Block a user