changeset 426:691e2b709489

docs improvements (see lightsd#9)
author Louis Opter <kalessin@kalessin.fr>
date Thu, 07 Jan 2016 23:05:03 +0100
parents 6477afd705d1
children 8c8acb2c8d72
files series white_colors_clarifications.patch
diffstat 2 files changed, 67 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/series	Thu Jan 07 11:20:14 2016 +0100
+++ b/series	Thu Jan 07 23:05:03 2016 +0100
@@ -1,6 +1,7 @@
 optional_jsonrpc_args.patch
 network_discovery.patch
 dont_use_ev_assign.patch
+white_colors_clarifications.patch
 add_power_transition.patch
 open_gateway_on_any_bulb_response.patch #+future
 make_gateway_write_callbacks_low_priority.patch #+future
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/white_colors_clarifications.patch	Thu Jan 07 23:05:03 2016 +0100
@@ -0,0 +1,66 @@
+# HG changeset patch
+# Parent  f4967b5e7623d6ac8706a2474f8a54d5cbe27354
+Improve the docs for set_light_from_hsbk and set_waveform
+
+Go beyond just saying what the parameters are and clarify whites vs
+colors.
+
+Closes GH-9.
+
+diff --git a/docs/protocol.rst b/docs/protocol.rst
+--- a/docs/protocol.rst
++++ b/docs/protocol.rst
+@@ -65,6 +65,11 @@
+ 
+ .. function:: set_light_from_hsbk(target, hue, saturation, brightness, kelvin[, transition])
+ 
++   Set the color of the given bulbs, if `hue` and `saturation` are both 0 then
++   the bulbs will be white otherwise you'll be setting an actual color. The
++   temperature parameter (`kelvin`) can be used to get a warmer or colder white
++   and will also affect colors.
++
+    :param float hue: From 0 to 360.
+    :param float saturation: From 0 to 1.
+    :param float brightness: From 0 to 1.
+@@ -74,6 +79,11 @@
+ 
+ .. function:: set_waveform(target, waveform, hue, saturation, brightness, kelvin, period, cycles, skew_ratio[, transient])
+ 
++   Repeatedly change the color of the given bulbs according to a periodic
++   (mathematical) function selected with the `waveform` parameter. The `hue`,
++   `saturation`, `brightness` and `kelvin` parameters work like in
++   :func:`set_light_from_hsbk`.
++
+    :param string waveform: One of ``SAW``, ``SINE``, ``HALF_SINE``,
+                            ``TRIANGLE``, ``SQUARE``.
+    :param float hue: From 0 to 360.
+@@ -88,7 +98,7 @@
+                           its original state. This argument is optional and
+                           defaults to true.
+ 
+-   The meaning of the ``skew_ratio`` argument depends on the type of waveform:
++   The meaning of the `skew_ratio` argument depends on the selected `waveform`:
+ 
+    +---------------+-----------------------------------------------------------+
+    | ``SAW``       | Should be 0.5.                                            |
+@@ -111,14 +121,15 @@
+    targeted bulb, the list is not in any specific order. Each dict has the
+    following fields:
+ 
+-   - hsbk: tuple (h, s, b, k) see function:`set_light_from_hsbk`;
+-   - label: bulb label (utf-8 encoded string);
+-   - power: boolean, true when the bulb is powered on false otherwise;
+-   - tags: list of tags applied to the bulb (utf-8 encoded strings).
++   - hsbk: tuple (h, s, b, k) as in :func:`set_light_from_hsbk`;
++   - label: bulb label;
++   - power: boolean, true when the bulb is powered on, false otherwise;
++   - tags: list of tags applied to the bulb.
+ 
+ .. function:: set_label(target, label)
+ 
+-   Label the target bulb(s) with the given label.
++   Label the target bulb(s) with the given label. UTF-8 encoded values are
++   recommended.
+ 
+    .. note::
+