From 2ea0327ad0bd190c059a1eadf47fda54fab679ba Mon Sep 17 00:00:00 2001 From: Steven B <51370195+sdb9696@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:19:37 +0000 Subject: [PATCH 1/2] dump_devinfo: iot light strip commands --- devtools/dump_devinfo.py | 3 + tests/fixtures/KL430(US)_2.0_1.0.11.json | 96 ++++++++++++++++++++++-- 2 files changed, 92 insertions(+), 7 deletions(-) diff --git a/devtools/dump_devinfo.py b/devtools/dump_devinfo.py index 0f30f96dd..3522ef14c 100644 --- a/devtools/dump_devinfo.py +++ b/devtools/dump_devinfo.py @@ -420,6 +420,9 @@ async def get_legacy_fixture( Call( module="smartlife.iot.smartbulb.lightingservice", method="get_light_details" ), + Call(module="smartlife.iot.lightStrip", method="get_default_behavior"), + Call(module="smartlife.iot.lightStrip", method="get_light_state"), + Call(module="smartlife.iot.lightStrip", method="get_light_details"), Call(module="smartlife.iot.LAS", method="get_config"), Call(module="smartlife.iot.LAS", method="get_current_brt"), Call(module="smartlife.iot.PIR", method="get_config"), diff --git a/tests/fixtures/KL430(US)_2.0_1.0.11.json b/tests/fixtures/KL430(US)_2.0_1.0.11.json index cf54d6ebf..f39c55193 100644 --- a/tests/fixtures/KL430(US)_2.0_1.0.11.json +++ b/tests/fixtures/KL430(US)_2.0_1.0.11.json @@ -1,4 +1,34 @@ { + "smartlife.iot.common.cloud": { + "get_info": { + "binded": 1, + "cld_connection": 1, + "err_code": 0, + "fwDlPage": "", + "fwNotifyType": -1, + "illegalType": 0, + "server": "n-devs.tplinkcloud.com", + "stopConnect": 0, + "tcspInfo": "", + "tcspStatus": 1, + "username": "#MASKED_NAME#" + }, + "get_intl_fw_list": { + "err_code": 0, + "fw_list": [ + { + "fwLocation": 0, + "fwReleaseDate": "2024-06-28", + "fwReleaseLog": "Modifications and Bug Fixes:\n1. Enhanced device stability.\n2. Fixed the problem that Color Painting doesn't work properly in some cases.\n3. Fixed some minor bugs.", + "fwReleaseLogUrl": "undefined yet", + "fwTitle": "Hi, a new firmware with bug fixes is available for your product.", + "fwType": 1, + "fwUrl": "http://download.tplinkcloud.com/firmware/KLM430v2_FCC_KL430_1.0.12_Build_240227_Rel.160022_2024-02-27_16.01.59_1719559326313.bin", + "fwVer": "1.0.12 Build 240227 Rel.160022" + } + ] + } + }, "smartlife.iot.common.emeter": { "get_realtime": { "err_code": 0, @@ -6,6 +36,58 @@ "total_wh": 0 } }, + "smartlife.iot.common.schedule": { + "get_next_action": { + "err_code": 0, + "type": -1 + }, + "get_rules": { + "enable": 0, + "err_code": 0, + "rule_list": [], + "version": 2 + } + }, + "smartlife.iot.lightStrip": { + "get_default_behavior": { + "err_code": 0, + "hard_on": { + "mode": "last_status" + }, + "soft_on": { + "mode": "last_status" + } + }, + "get_light_details": { + "color_rendering_index": 80, + "err_code": 0, + "incandescent_equivalent": 60, + "lamp_beam_angle": 180, + "max_lumens": 800, + "max_voltage": 120, + "min_voltage": 100, + "wattage": 10 + }, + "get_light_state": { + "dft_on_state": { + "groups": [ + [ + 0, + 15, + 0, + 0, + 100, + 3842 + ] + ], + "mode": "normal" + }, + "err_code": 0, + "length": 16, + "on_off": 0, + "transition": 500 + } + }, "system": { "get_sysinfo": { "LEF": 1, @@ -31,19 +113,19 @@ "light_state": { "dft_on_state": { "brightness": 100, - "color_temp": 9000, - "hue": 9, + "color_temp": 3842, + "hue": 0, "mode": "normal", - "saturation": 67 + "saturation": 0 }, "on_off": 0 }, "lighting_effect_state": { - "brightness": 70, + "brightness": 100, "custom": 0, "enable": 0, - "id": "joqVjlaTsgzmuQQBAlHRkkPAqkBUiqeb", - "name": "Icicle" + "id": "bCTItKETDFfrKANolgldxfgOakaarARs", + "name": "Flicker" }, "longitude_i": 0, "mic_mac": "E8:48:B8:00:00:00", @@ -51,7 +133,7 @@ "model": "KL430(US)", "oemId": "00000000000000000000000000000000", "preferred_state": [], - "rssi": -43, + "rssi": -35, "status": "new", "sw_ver": "1.0.11 Build 220812 Rel.153345" } From b4b9a6328f9b015a107a8fb62146bfde36a1d9d6 Mon Sep 17 00:00:00 2001 From: Steven B <51370195+sdb9696@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:36:41 +0000 Subject: [PATCH 2/2] Fix test --- tests/test_bulb.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_bulb.py b/tests/test_bulb.py index ac4400731..1589e9199 100644 --- a/tests/test_bulb.py +++ b/tests/test_bulb.py @@ -453,6 +453,8 @@ async def test_modify_preset_payloads(dev: IotBulb, preset, payload, mocker): "mode": str, "on_off": Boolean, "saturation": All(int, Range(min=0, max=100)), + "length": Optional(int), + "transition": Optional(int), "dft_on_state": Optional( { "brightness": All(int, Range(min=0, max=100)), @@ -460,6 +462,7 @@ async def test_modify_preset_payloads(dev: IotBulb, preset, payload, mocker): "hue": All(int, Range(min=0, max=360)), "mode": str, "saturation": All(int, Range(min=0, max=100)), + "groups": Optional(list[int]), } ), "err_code": int,