mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-12 02:18:02 +00:00
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:
@@ -9,6 +9,7 @@ from kasa.protocol import TPLinkSmartHomeProtocol
|
||||
from kasa.smartbulb import SmartBulb
|
||||
from kasa.smartdevice import SmartDevice, SmartDeviceException
|
||||
from kasa.smartdimmer import SmartDimmer
|
||||
from kasa.smartlightstrip import SmartLightStrip
|
||||
from kasa.smartplug import SmartPlug
|
||||
from kasa.smartstrip import SmartStrip
|
||||
|
||||
@@ -227,11 +228,19 @@ class Discover:
|
||||
and "get_dimmer_parameters" in info["smartlife.iot.dimmer"]
|
||||
):
|
||||
return SmartDimmer
|
||||
|
||||
elif "smartplug" in type_.lower() and "children" in sysinfo:
|
||||
return SmartStrip
|
||||
|
||||
elif "smartplug" in type_.lower():
|
||||
if "children" in sysinfo:
|
||||
return SmartStrip
|
||||
|
||||
return SmartPlug
|
||||
elif "smartbulb" in type_.lower():
|
||||
if "length" in sysinfo: # strips have length
|
||||
return SmartLightStrip
|
||||
|
||||
return SmartBulb
|
||||
|
||||
raise SmartDeviceException("Unknown device type: %s", type_)
|
||||
|
Reference in New Issue
Block a user