Add support for lightstrips (KL430) (#74)

* Preliminary support for light strips

* Add color temperature range and cleanup, thanks to @darkoppressor

* Use lightstrip instead of {led,light}strip consistently everywhere
* The cli flag is now --lightstrip

* add apidocs

* Add fixture file for KL430

Signed-off-by: Kevin Wells <darkoppressor@gmail.com>

* Add discovery support, expose effect and length of the strip

* use set_light_state instead of transition_light_state

* Add tests for lightstrip

* add doctests

* Add KL430 to supported devices in README

Co-authored-by: Kevin Wells <darkoppressor@gmail.com>
This commit is contained in:
Teemu R
2020-07-19 22:32:17 +02:00
committed by GitHub
parent 0edbb4301f
commit d30d00a3ff
15 changed files with 249 additions and 15 deletions

View File

@@ -355,7 +355,8 @@ class FakeTransportProtocol(TPLinkSmartHomeProtocol):
light_state = self.proto["system"]["get_sysinfo"]["light_state"]
# Our tests have light state off, so we simply return the dft_on_state when device is on.
_LOGGER.debug("reporting light state: %s", light_state)
if light_state["on_off"]:
# TODO: hack to go around KL430 fixture differences
if light_state["on_off"] and "dft_on_state" in light_state:
return light_state["dft_on_state"]
else:
return light_state
@@ -385,6 +386,11 @@ class FakeTransportProtocol(TPLinkSmartHomeProtocol):
"get_light_state": light_state,
"transition_light_state": transition_light_state,
},
# lightstrip follows the same payloads but uses different module & method
"smartlife.iot.lightStrip": {
"set_light_state": transition_light_state,
"get_light_state": light_state,
},
"time": {
"get_time": {
"year": 2017,