Add link to docs

This commit is contained in:
Fabian Affolter 2015-11-13 08:29:54 +01:00
parent 7ebda9c3c6
commit d993f4014e
2 changed files with 16 additions and 35 deletions

View File

@ -1,34 +1,10 @@
"""
homeassistant.components.light.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to configure a MQTT light.
config for RGB Version with brightness:
light:
platform: mqtt
name: "Office Light RGB"
state_topic: "office/rgb1/light/status"
command_topic: "office/rgb1/light/switch"
brightness_state_topic: "office/rgb1/brightness/status"
brightness_command_topic: "office/rgb1/brightness/set"
rgb_state_topic: "office/rgb1/rgb/status"
rgb_command_topic: "office/rgb1/rgb/set"
qos: 0
payload_on: "on"
payload_off: "off"
config without RGB:
light:
platform: mqtt
name: "Office Light"
state_topic: "office/rgb1/light/status"
command_topic: "office/rgb1/light/switch"
qos: 0
payload_on: "on"
payload_off: "off"
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.mqtt/
"""
import logging
@ -79,7 +55,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
class MqttLight(Light):
""" Provides a demo Mqtt light. """
""" Provides a MQTT light. """
# pylint: disable=too-many-arguments
def __init__(self, hass, name,
@ -112,12 +88,12 @@ class MqttLight(Light):
# force optimistic mode
self._optimistic = True
else:
# subscribe the state_topic
# Subscribe the state_topic
mqtt.subscribe(self._hass, self._topic["state_topic"],
message_received, self._qos)
def brightness_received(topic, payload, qos):
""" A new MQTT message has been received. """
""" A new MQTT message for the brightness has been received. """
self._brightness = int(payload)
self.update_ha_state()
@ -160,7 +136,7 @@ class MqttLight(Light):
@property
def should_poll(self):
""" No polling needed for a demo light. """
""" No polling needed for a MQTT light. """
return False
@property

View File

@ -1,7 +1,10 @@
"""
homeassistant.components.light.zwave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Z-Wave lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.zwave/
"""
# pylint: disable=import-error
from openzwave.network import ZWaveNetwork
@ -15,7 +18,7 @@ from threading import Timer
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Find and add zwave lights. """
""" Find and add Z-Wave lights. """
if discovery_info is None:
return
@ -34,8 +37,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
def brightness_state(value):
""" Returns the brightness and state according to the current
data of given value. """
"""
Returns the brightness and state according to the current data of given
value.
"""
if value.data > 0:
return (value.data / 99) * 255, STATE_ON
else:
@ -43,7 +48,7 @@ def brightness_state(value):
class ZwaveDimmer(Light):
""" Provides a zwave dimmer. """
""" Provides a Z-Wave dimmer. """
# pylint: disable=too-many-arguments
def __init__(self, value):
self._value = value