From d993f4014e66674a8d8d22ce818f882b1bbe4832 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 13 Nov 2015 08:29:54 +0100 Subject: [PATCH] Add link to docs --- homeassistant/components/light/mqtt.py | 38 +++++-------------------- homeassistant/components/light/zwave.py | 13 ++++++--- 2 files changed, 16 insertions(+), 35 deletions(-) diff --git a/homeassistant/components/light/mqtt.py b/homeassistant/components/light/mqtt.py index 4e9b58e272e..f65c99e43e3 100644 --- a/homeassistant/components/light/mqtt.py +++ b/homeassistant/components/light/mqtt.py @@ -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 diff --git a/homeassistant/components/light/zwave.py b/homeassistant/components/light/zwave.py index 10e75125e12..f1cd6f57fc0 100644 --- a/homeassistant/components/light/zwave.py +++ b/homeassistant/components/light/zwave.py @@ -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