| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
After switching on with kasa --host 192.168.0.17 on command the LEDs are not turning on but when I check with kasa --host 192.168.0.17 state the status indicated ON (same status in the Kasa android app)
| python-kasa version | kasa, version 0.4.0.dev3 |
|---|---|
| python version | 3.8.10 |
| OS | Ubuntu 20.04.2 LTS |
Dump when I use python-kasa cli:
{
"smartlife.iot.common.emeter": {
"get_daystat": {
"day_list": [
{
"day": 14,
"energy_wh": 5,
"month": 8,
"year": 2021
},
{
"day": 16,
"energy_wh": 103,
"month": 8,
"year": 2021
}
],
"err_code": 0
},
"get_monthstat": {
"err_code": 0,
"month_list": [
{
"energy_wh": 108,
"month": 8,
"year": 2021
}
]
},
"get_realtime": {
"err_code": 0,
"power_mw": 16760,
"total_wh": 103
}
},
"system": {
"get_sysinfo": {
"LEF": 1,
"active_mode": "none",
"alias": "light strip",
"ctrl_protocols": {
"name": "Linkie",
"version": "1.0"
},
"description": "Kasa Smart Light Strip, Multicolor",
"dev_state": "normal",
"deviceId": "***",
"disco_ver": "1.0",
"err_code": 0,
"hwId": "***",
"hw_ver": "2.0",
"is_color": 1,
"is_dimmable": 1,
"is_factory": false,
"is_variable_color_temp": 1,
"latitude_i": ***,
"length": 16,
"light_state": {
"brightness": 100,
"color_temp": 9000,
"hue": 0,
"mode": "normal",
"on_off": 1,
"saturation": 0
},
"lighting_effect_state": {
"brightness": 100,
"custom": 1,
"enable": 0,
"id": "yMwcNpLxijmoKamskHCvvravpbnIqAIN",
"name": "Aurora 1"
},
"longitude_i": ***,
"mic_mac": "C0:06:C3:**:**:**",
"mic_type": "IOT.SMARTBULB",
"model": "KL430(UN)",
"oemId": "***",
"preferred_state": [
{
"brightness": 100,
"color_temp": 9000,
"hue": 0,
"index": 0,
"mode": 1,
"saturation": 0
},
{
"brightness": 100,
"color_temp": 0,
"hue": 217,
"index": 1,
"mode": 1,
"saturation": 99
},
{
"brightness": 100,
"color_temp": 0,
"hue": 194,
"index": 2,
"mode": 1,
"saturation": 50
},
{
"brightness": 100,
"color_temp": 0,
"hue": 277,
"index": 3,
"mode": 1,
"saturation": 86
}
],
"rssi": -42,
"status": "new",
"sw_ver": "1.0.8 Build 210121 Rel.084339"
}
}
}
Dump when I use Kasa android app:
{
"smartlife.iot.common.emeter": {
"get_daystat": {
"day_list": [
{
"day": 14,
"energy_wh": 5,
"month": 8,
"year": 2021
},
{
"day": 16,
"energy_wh": 103,
"month": 8,
"year": 2021
}
],
"err_code": 0
},
"get_monthstat": {
"err_code": 0,
"month_list": [
{
"energy_wh": 108,
"month": 8,
"year": 2021
}
]
},
"get_realtime": {
"err_code": 0,
"power_mw": 16760,
"total_wh": 103
}
},
"system": {
"get_sysinfo": {
"LEF": 1,
"active_mode": "none",
"alias": "light strip",
"ctrl_protocols": {
"name": "Linkie",
"version": "1.0"
},
"description": "Kasa Smart Light Strip, Multicolor",
"dev_state": "normal",
"deviceId": "***",
"disco_ver": "1.0",
"err_code": 0,
"hwId": "***",
"hw_ver": "2.0",
"is_color": 1,
"is_dimmable": 1,
"is_factory": false,
"is_variable_color_temp": 1,
"latitude_i": ***,
"length": 16,
"light_state": {
"brightness": 100,
"color_temp": 9000,
"hue": 0,
"mode": "normal",
"on_off": 1,
"saturation": 0
},
"lighting_effect_state": {
"brightness": 100,
"custom": 1,
"enable": 1,
"id": "yMwcNpLxijmoKamskHCvvravpbnIqAIN",
"name": "Aurora 1"
},
"longitude_i": ***,
"mic_mac": "C0:06:C3:**:**:**",
"mic_type": "IOT.SMARTBULB",
"model": "KL430(UN)",
"oemId": "***",
"preferred_state": [
{
"brightness": 100,
"color_temp": 9000,
"hue": 0,
"index": 0,
"mode": 1,
"saturation": 0
},
{
"brightness": 100,
"color_temp": 0,
"hue": 217,
"index": 1,
"mode": 1,
"saturation": 99
},
{
"brightness": 100,
"color_temp": 0,
"hue": 194,
"index": 2,
"mode": 1,
"saturation": 50
},
{
"brightness": 100,
"color_temp": 0,
"hue": 277,
"index": 3,
"mode": 1,
"saturation": 86
}
],
"rssi": -44,
"status": "new",
"sw_ver": "1.0.8 Build 210121 Rel.084339"
}
}
}
If you compare both dump files you will see that one parameter is different system.lighting_effect_state.enable
| Back | FazBrowse Home | New Git URL |
Activity
rytilahti commented on Aug 16, 2021
Looks like that the strip has different modes and that the effect mode is controlled separately (the light uses light_state.on_off for the state). There is currently no handling for the effect mode as the commands are unknown. Maybe you could do a packet capture and use the devtools/parse_pcap.py to find out how the app controls the effect mode & what sort of logic we need to add?
rytilahti commented on Aug 16, 2021
Looks like yours has a separate LEF key in the sysinfo, maybe that's related? Also, could you use the dump_devinfo and create a PR to add a fixture under https://github.com/python-kasa/python-kasa/tree/master/kasa/tests/fixtures ?
iprodanovbg commented on Aug 16, 2021
I created PR #192 with dump for the device
iprodanovbg commented on Aug 17, 2021
HI @rytilahti
I managed to turn on the LEDs when I execute the "on" command.
The KL430 light strip have another service smartlife.iot.lighting_effect and method set_lighting_effect with set the effects to each zone in the strip.
This is the code I tested at my end:
File: smartdevice.py
Code:
File: smartlightstrip.py
Code:
However this is first preset effect in Kasa app and there is dump for all effectes:
{"custom": 0, "id": "xqUxDhbAhNLqulcuRMyPBmVGyTOyEMEu", "brightness": 100, "name": "Aurora", "segments": [0], "expansion_strategy": 1, "enable": 1, "type": "sequence", "duration": 0, "transition": 1500, "direction": 4, "spread": 7, "repeat_times": 0, "sequence": [[120, 100, 100], [240, 100, 100], [260, 100, 100], [280, 100, 100]]}{"custom": 0, "id": "tIwTRQBqJpeNKbrtBMFCgkdPTbAQGfRP", "brightness": 100, "name": "Bubbling Cauldron", "segments": [0], "expansion_strategy": 1, "enable": 1, "type": "random", "hue_range": [100, 270], "saturation_range": [80, 100], "brightness_range": [50, 100], "duration": 0, "transition": 200, "init_states": [[270, 100, 100]], "fadeoff": 1000, "random_seed": 24, "backgrounds": [[270, 40, 50]]}{"custom": 0, "id": "HCOttllMkNffeHjEOLEgrFJjbzQHoxEJ", "brightness": 100, "name": "Candy Cane", "segments": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], "expansion_strategy": 1, "enable": 1, "type": "sequence", "duration": 700, "transition": 500, "direction": 1, "spread": 1, "repeat_times": 0, "sequence": [[0, 0, 100], [0, 0, 100], [360, 81, 100], [0, 0, 100], [0, 0, 100], [360, 81, 100], [360, 81, 100], [0, 0, 100], [0, 0, 100], [360, 81, 100], [360, 81, 100], [360, 81, 100], [360, 81, 100], [0, 0, 100], [0, 0, 100], [360, 81, 100]]}{"custom": 0, "id": "bwTatyinOUajKrDwzMmqxxJdnInQUgvM", "brightness": 100, "name": "Christmas", "segments": [0], "expansion_strategy": 1, "enable": 1, "type": "random", "hue_range": [136, 146], "saturation_range": [90, 100], "brightness_range": [50, 100], "duration": 5000, "transition": 0, "init_states": [[136, 0, 100]], "fadeoff": 2000, "random_seed": 100, "backgrounds": [[136, 98, 75], [136, 0, 0], [350, 0, 100], [350, 97, 94]]}{"custom": 0, "id": "bCTItKETDFfrKANolgldxfgOakaarARs", "brightness": 100, "name": "Flicker", "segments": [1], "expansion_strategy": 1, "enable": 1, "type": "random", "hue_range": [30, 40], "saturation_range": [100, 100], "brightness_range": [50, 100], "duration": 0, "transition": 0, "transition_range": [375, 500], "init_states": [[30, 81, 80]]}{"custom": 0, "id": "CdLeIgiKcQrLKMINRPTMbylATulQewLD", "brightness": 100, "name": "Hanukkah", "segments": [1], "expansion_strategy": 1, "enable": 1, "type": "random", "hue_range": [200, 210], "saturation_range": [0, 100], "brightness_range": [50, 100], "duration": 1500, "transition": 0, "transition_range": [400, 500], "init_states": [[35, 81, 80]]}{"custom": 0, "id": "oJnFHsVQzFUTeIOBAhMRfVeujmSauhjJ", "brightness": 80, "name": "Haunted Mansion", "segments": [80], "expansion_strategy": 2, "enable": 1, "type": "random", "hue_range": [45, 45], "saturation_range": [10, 10], "brightness_range": [0, 80], "duration": 0, "transition": 0, "transition_range": [50, 1500], "init_states": [[45, 10, 100]], "fadeoff": 200, "random_seed": 1, "backgrounds": [[45, 10, 100]]}{"custom": 0, "id": "joqVjlaTsgzmuQQBAlHRkkPAqkBUiqeb", "brightness": 70, "name": "Icicle", "segments": [0], "expansion_strategy": 1, "enable": 1, "type": "sequence", "duration": 0, "transition": 400, "direction": 4, "spread": 3, "repeat_times": 0, "sequence": [[190, 100, 70], [190, 100, 70], [190, 30, 50], [190, 100, 70], [190, 100, 70]]}{"custom": 0, "id": "ojqpUUxdGHoIugGPknrUcRoyJiItsjuE", "brightness": 100, "name": "Lightning", "segments": [7, 20, 23, 32, 34, 35, 49, 65, 66, 74, 80], "expansion_strategy": 1, "enable": 1, "type": "random", "hue_range": [240, 240], "saturation_range": [10, 11], "brightness_range": [90, 100], "duration": 0, "transition": 50, "init_states": [[240, 30, 100]], "fadeoff": 150, "random_seed": 600, "backgrounds": [[200, 100, 100], [200, 50, 10], [210, 10, 50], [240, 10, 0]]}{"custom": 0, "id": "oJjUMosgEMrdumfPANKbkFmBcAdEQsPy", "brightness": 30, "name": "Ocean", "segments": [0], "expansion_strategy": 1, "enable": 1, "type": "sequence", "duration": 0, "transition": 2000, "direction": 3, "spread": 16, "repeat_times": 0, "sequence": [[198, 84, 30], [198, 70, 30], [198, 10, 30]]}{"custom": 0, "id": "izRhLCQNcDzIKdpMPqSTtBMuAIoreAuT", "brightness": 100, "name": "Rainbow", "segments": [0], "expansion_strategy": 1, "enable": 1, "type": "sequence", "duration": 0, "transition": 1500, "direction": 1, "spread": 12, "repeat_times": 0, "sequence": [[0, 100, 100], [100, 100, 100], [200, 100, 100], [300, 100, 100]]}{"custom": 0, "id": "QbDFwiSFmLzQenUOPnJrsGqyIVrJrRsl", "brightness": 30, "name": "Raindrop", "segments": [0], "expansion_strategy": 1, "enable": 1, "type": "random", "hue_range": [200, 200], "saturation_range": [10, 20], "brightness_range": [10, 30], "duration": 0, "transition": 1000, "init_states": [[200, 40, 100]], "fadeoff": 1000, "random_seed": 24, "backgrounds": [[200, 40, 0]]}{"custom": 0, "id": "URdUpEdQbnOOechDBPMkKrwhSupLyvAg", "brightness": 100, "name": "Spring", "segments": [0], "expansion_strategy": 1, "enable": 1, "type": "random", "hue_range": [0, 90], "saturation_range": [30, 100], "brightness_range": [90, 100], "duration": 600, "transition": 0, "transition_range": [2000, 6000], "init_states": [[80, 30, 100]], "fadeoff": 1000, "random_seed": 20, "backgrounds": [[130, 100, 40]]}{"custom": 0, "id": "QglBhMShPHUAuxLqzNEefFrGiJwahOmz", "brightness": 100, "name": "Valentines", "segments": [0], "expansion_strategy": 1, "enable": 1, "type": "random", "hue_range": [340, 340], "saturation_range": [30, 40], "brightness_range": [90, 100], "duration": 600, "transition": 2000, "init_states": [[340, 30, 100]], "fadeoff": 3000, "random_seed": 100, "backgrounds": [[340, 20, 50], [20, 50, 50], [0, 100, 50]]}rytilahti commented on Aug 17, 2021
@iprodanovbg glad that you figured it out! I think the proper way to support this would be adding some new functionality (e.g. set_effect(Effect) for setting the effect) and adapt is_on (and others like turn_on if we can differentiate between the regular mode and the effect mode?) to take the effect on state into account when reporting on the state state.
iprodanovbg commented on Aug 28, 2021
Yes I agree with you this should be different function. Unfortunately last days I have no time to research more about this problem.
steveredden commented on Sep 14, 2021
have either of you found a way to smartlife.iot.lighting_effect > set_lighting_effect via CLI?
Been trying on the CLI with raw-command and haven't found a valid "PARAMETERS" (bombs at cli.py:267)
kasa --host <ip> raw-command "smartlife.iot.lighting_effect" "set_lighting_effect" <whaaaaat>
passed a string representation of json, using single-quote around each key, and no spaces.
ex: Aurora:
SergeantPup commented on Jan 17, 2022
Hello,
I just migrated from HE because the KL430s are NOW working on HA natively. We had gotten the effects working for the KL430's in HE and it looks like you've got all the information that's needed to get the effects working. I am anxious to automate effects to my 37 KL340s but I can't figure out what I'm missing.
Are we waiting on dev work for this to be possible? It looks like the above post offers a workaround while we wait but unfortunately, that's a little outside my skill level unless somebody can walk me through the actual steps of making the workaround work on command.
I'm just trying to clarify where this project is at so I can determine if I'm doing something wrong or if there's still a gap.
bdraco commented on Jan 28, 2022
It looks like tplink has finally fixed the firmware on these
https://community.tp-link.com/us/smart-home/forum/topic/242590
Maybe I can actually get it to connect to wifi now
bdraco commented on Jan 28, 2022
Wifi Worked now.
Release 0.4.2
Release 0.4.2 (#321)
Release 0.4.2 (python-kasa#321)