From 65c47a937306538c428bbad60e24fb7c31c808f2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 22 Jan 2024 21:12:54 -1000 Subject: [PATCH] Update fixtures from test devices (#679) * Update fixtures from test devices * move l920 to another pr --- kasa/tests/fixtures/HS300(US)_2.0_1.0.12.json | 90 ++++ kasa/tests/fixtures/KL125(US)_4.0_1.0.5.json | 93 ++++ kasa/tests/fixtures/KL430(US)_2.0_1.0.11.json | 59 +++ kasa/tests/fixtures/KP115(US)_1.0_1.0.21.json | 42 ++ .../fixtures/smart/EP25(US)_2.6_1.0.2.json | 414 ++++++++++++++++++ .../fixtures/smart/L530E(US)_2.0_1.1.0.json | 34 +- .../fixtures/smart/P125M(US)_1.0_1.1.0.json | 22 +- 7 files changed, 726 insertions(+), 28 deletions(-) create mode 100644 kasa/tests/fixtures/HS300(US)_2.0_1.0.12.json create mode 100644 kasa/tests/fixtures/KL125(US)_4.0_1.0.5.json create mode 100644 kasa/tests/fixtures/KL430(US)_2.0_1.0.11.json create mode 100644 kasa/tests/fixtures/KP115(US)_1.0_1.0.21.json create mode 100644 kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.2.json diff --git a/kasa/tests/fixtures/HS300(US)_2.0_1.0.12.json b/kasa/tests/fixtures/HS300(US)_2.0_1.0.12.json new file mode 100644 index 00000000..bdab432e --- /dev/null +++ b/kasa/tests/fixtures/HS300(US)_2.0_1.0.12.json @@ -0,0 +1,90 @@ +{ + "emeter": { + "get_realtime": { + "current_ma": 6, + "err_code": 0, + "power_mw": 277, + "slot_id": 0, + "total_wh": 62, + "voltage_mv": 120110 + } + }, + "system": { + "get_sysinfo": { + "alias": "#MASKED_NAME#", + "child_num": 6, + "children": [ + { + "alias": "#MASKED_NAME#", + "id": "8006A0F1D01120C3F93794F7AACACDBE1EAD246D00", + "next_action": { + "type": -1 + }, + "on_time": 710216, + "state": 1 + }, + { + "alias": "#MASKED_NAME#", + "id": "8006A0F1D01120C3F93794F7AACACDBE1EAD246D01", + "next_action": { + "type": -1 + }, + "on_time": 710216, + "state": 1 + }, + { + "alias": "#MASKED_NAME#", + "id": "8006A0F1D01120C3F93794F7AACACDBE1EAD246D02", + "next_action": { + "type": -1 + }, + "on_time": 710216, + "state": 1 + }, + { + "alias": "#MASKED_NAME#", + "id": "8006A0F1D01120C3F93794F7AACACDBE1EAD246D03", + "next_action": { + "type": -1 + }, + "on_time": 710216, + "state": 1 + }, + { + "alias": "#MASKED_NAME#", + "id": "8006A0F1D01120C3F93794F7AACACDBE1EAD246D04", + "next_action": { + "type": -1 + }, + "on_time": 710216, + "state": 1 + }, + { + "alias": "#MASKED_NAME#", + "id": "8006A0F1D01120C3F93794F7AACACDBE1EAD246D05", + "next_action": { + "type": -1 + }, + "on_time": 710216, + "state": 1 + } + ], + "deviceId": "0000000000000000000000000000000000000000", + "err_code": 0, + "feature": "TIM:ENE", + "hwId": "00000000000000000000000000000000", + "hw_ver": "2.0", + "latitude_i": 0, + "led_off": 0, + "longitude_i": 0, + "mac": "C0:06:C3:00:00:00", + "mic_type": "IOT.SMARTPLUGSWITCH", + "model": "HS300(US)", + "oemId": "00000000000000000000000000000000", + "rssi": -44, + "status": "new", + "sw_ver": "1.0.12 Build 220121 Rel.175814", + "updating": 0 + } + } +} diff --git a/kasa/tests/fixtures/KL125(US)_4.0_1.0.5.json b/kasa/tests/fixtures/KL125(US)_4.0_1.0.5.json new file mode 100644 index 00000000..b098dbda --- /dev/null +++ b/kasa/tests/fixtures/KL125(US)_4.0_1.0.5.json @@ -0,0 +1,93 @@ +{ + "smartlife.iot.common.emeter": { + "get_realtime": { + "err_code": 0, + "power_mw": 0, + "total_wh": 0 + } + }, + "smartlife.iot.smartbulb.lightingservice": { + "get_light_state": { + "dft_on_state": { + "brightness": 84, + "color_temp": 0, + "hue": 9, + "mode": "normal", + "saturation": 67 + }, + "err_code": 0, + "on_off": 0 + } + }, + "system": { + "get_sysinfo": { + "active_mode": "none", + "alias": "#MASKED_NAME#", + "ctrl_protocols": { + "name": "Linkie", + "version": "1.0" + }, + "description": "Smart Wi-Fi LED Bulb with Color Changing", + "dev_state": "normal", + "deviceId": "0000000000000000000000000000000000000000", + "disco_ver": "1.0", + "err_code": 0, + "hwId": "00000000000000000000000000000000", + "hw_ver": "4.0", + "is_color": 1, + "is_dimmable": 1, + "is_factory": false, + "is_variable_color_temp": 1, + "latitude_i": 0, + "light_state": { + "dft_on_state": { + "brightness": 84, + "color_temp": 0, + "hue": 9, + "mode": "normal", + "saturation": 67 + }, + "on_off": 0 + }, + "longitude_i": 0, + "mic_mac": "5091E3000000", + "mic_type": "IOT.SMARTBULB", + "model": "KL125(US)", + "obd_src": "tplink", + "oemId": "00000000000000000000000000000000", + "preferred_state": [ + { + "brightness": 50, + "color_temp": 2700, + "hue": 0, + "index": 0, + "saturation": 0 + }, + { + "brightness": 100, + "color_temp": 0, + "hue": 0, + "index": 1, + "saturation": 100 + }, + { + "brightness": 100, + "color_temp": 0, + "hue": 120, + "index": 2, + "saturation": 100 + }, + { + "brightness": 100, + "color_temp": 0, + "hue": 240, + "index": 3, + "saturation": 100 + } + ], + "rssi": -37, + "status": "new", + "sw_ver": "1.0.5 Build 230613 Rel.151643" + } + } +} diff --git a/kasa/tests/fixtures/KL430(US)_2.0_1.0.11.json b/kasa/tests/fixtures/KL430(US)_2.0_1.0.11.json new file mode 100644 index 00000000..cf54d6eb --- /dev/null +++ b/kasa/tests/fixtures/KL430(US)_2.0_1.0.11.json @@ -0,0 +1,59 @@ +{ + "smartlife.iot.common.emeter": { + "get_realtime": { + "err_code": 0, + "power_mw": 600, + "total_wh": 0 + } + }, + "system": { + "get_sysinfo": { + "LEF": 1, + "active_mode": "none", + "alias": "#MASKED_NAME#", + "ctrl_protocols": { + "name": "Linkie", + "version": "1.0" + }, + "description": "Kasa Smart Light Strip, Multicolor", + "dev_state": "normal", + "deviceId": "0000000000000000000000000000000000000000", + "disco_ver": "1.0", + "err_code": 0, + "hwId": "00000000000000000000000000000000", + "hw_ver": "2.0", + "is_color": 1, + "is_dimmable": 1, + "is_factory": false, + "is_variable_color_temp": 1, + "latitude_i": 0, + "length": 16, + "light_state": { + "dft_on_state": { + "brightness": 100, + "color_temp": 9000, + "hue": 9, + "mode": "normal", + "saturation": 67 + }, + "on_off": 0 + }, + "lighting_effect_state": { + "brightness": 70, + "custom": 0, + "enable": 0, + "id": "joqVjlaTsgzmuQQBAlHRkkPAqkBUiqeb", + "name": "Icicle" + }, + "longitude_i": 0, + "mic_mac": "E8:48:B8:00:00:00", + "mic_type": "IOT.SMARTBULB", + "model": "KL430(US)", + "oemId": "00000000000000000000000000000000", + "preferred_state": [], + "rssi": -43, + "status": "new", + "sw_ver": "1.0.11 Build 220812 Rel.153345" + } + } +} diff --git a/kasa/tests/fixtures/KP115(US)_1.0_1.0.21.json b/kasa/tests/fixtures/KP115(US)_1.0_1.0.21.json new file mode 100644 index 00000000..f073e792 --- /dev/null +++ b/kasa/tests/fixtures/KP115(US)_1.0_1.0.21.json @@ -0,0 +1,42 @@ +{ + "emeter": { + "get_realtime": { + "current_ma": 0, + "err_code": 0, + "power_mw": 0, + "total_wh": 0, + "voltage_mv": 120652 + } + }, + "system": { + "get_sysinfo": { + "active_mode": "none", + "alias": "#MASKED_NAME#", + "dev_name": "Smart Wi-Fi Plug Mini", + "deviceId": "0000000000000000000000000000000000000000", + "err_code": 0, + "feature": "TIM:ENE", + "hwId": "00000000000000000000000000000000", + "hw_ver": "1.0", + "icon_hash": "", + "latitude_i": 0, + "led_off": 0, + "longitude_i": 0, + "mac": "54:AF:97:00:00:00", + "mic_type": "IOT.SMARTPLUGSWITCH", + "model": "KP115(US)", + "next_action": { + "type": -1 + }, + "ntc_state": 0, + "obd_src": "tplink", + "oemId": "00000000000000000000000000000000", + "on_time": 0, + "relay_state": 0, + "rssi": -60, + "status": "new", + "sw_ver": "1.0.21 Build 231129 Rel.171238", + "updating": 0 + } + } +} diff --git a/kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.2.json b/kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.2.json new file mode 100644 index 00000000..2d3e2e5e --- /dev/null +++ b/kasa/tests/fixtures/smart/EP25(US)_2.6_1.0.2.json @@ -0,0 +1,414 @@ +{ + "component_nego": { + "component_list": [ + { + "id": "device", + "ver_code": 2 + }, + { + "id": "firmware", + "ver_code": 2 + }, + { + "id": "quick_setup", + "ver_code": 3 + }, + { + "id": "time", + "ver_code": 1 + }, + { + "id": "wireless", + "ver_code": 1 + }, + { + "id": "schedule", + "ver_code": 2 + }, + { + "id": "countdown", + "ver_code": 2 + }, + { + "id": "antitheft", + "ver_code": 1 + }, + { + "id": "account", + "ver_code": 1 + }, + { + "id": "synchronize", + "ver_code": 1 + }, + { + "id": "sunrise_sunset", + "ver_code": 1 + }, + { + "id": "led", + "ver_code": 1 + }, + { + "id": "cloud_connect", + "ver_code": 1 + }, + { + "id": "iot_cloud", + "ver_code": 1 + }, + { + "id": "device_local_time", + "ver_code": 1 + }, + { + "id": "default_states", + "ver_code": 1 + }, + { + "id": "auto_off", + "ver_code": 2 + }, + { + "id": "energy_monitoring", + "ver_code": 2 + }, + { + "id": "power_protection", + "ver_code": 1 + }, + { + "id": "homekit", + "ver_code": 2 + }, + { + "id": "current_protection", + "ver_code": 1 + } + ] + }, + "discovery_result": { + "device_id": "00000000000000000000000000000000", + "device_model": "EP25(US)", + "device_type": "SMART.KASAPLUG", + "factory_default": false, + "ip": "127.0.0.123", + "is_support_iot_cloud": true, + "mac": "3C-52-A1-00-00-00", + "mgt_encrypt_schm": { + "encrypt_type": "AES", + "http_port": 80, + "is_support_https": false, + "lv": 2 + }, + "obd_src": "tplink", + "owner": "00000000000000000000000000000000" + }, + "get_antitheft_rules": { + "antitheft_rule_max_count": 1, + "enable": false, + "rule_list": [] + }, + "get_auto_off_config": { + "delay_min": 120, + "enable": false + }, + "get_auto_update_info": { + "enable": true, + "random_range": 120, + "time": 180 + }, + "get_connect_cloud_state": { + "status": 0 + }, + "get_countdown_rules": { + "countdown_rule_max_count": 1, + "enable": false, + "rule_list": [] + }, + "get_current_power": { + "current_power": 0 + }, + "get_device_info": { + "auto_off_remain_time": 0, + "auto_off_status": "off", + "avatar": "plug", + "default_states": { + "state": {}, + "type": "last_states" + }, + "device_id": "0000000000000000000000000000000000000000", + "device_on": true, + "fw_id": "00000000000000000000000000000000", + "fw_ver": "1.0.2 Build 231108 Rel.163012", + "has_set_location_info": true, + "hw_id": "00000000000000000000000000000000", + "hw_ver": "2.6", + "ip": "127.0.0.123", + "lang": "en_US", + "latitude": 0, + "longitude": 0, + "mac": "3C-52-A1-00-00-00", + "model": "EP25", + "nickname": "I01BU0tFRF9OQU1FIw==", + "oem_id": "00000000000000000000000000000000", + "on_time": 155838, + "overcurrent_status": "normal", + "overheated": false, + "power_protection_status": "normal", + "region": "America/Chicago", + "rssi": -56, + "signal_level": 2, + "specs": "", + "ssid": "I01BU0tFRF9TU0lEIw==", + "time_diff": -360, + "type": "SMART.KASAPLUG" + }, + "get_device_time": { + "region": "America/Chicago", + "time_diff": -360, + "timestamp": 1705991903 + }, + "get_device_usage": { + "power_usage": { + "past30": 0, + "past7": 0, + "today": 0 + }, + "saved_power": { + "past30": 41789, + "past7": 8678, + "today": 38 + }, + "time_usage": { + "past30": 41789, + "past7": 8678, + "today": 38 + } + }, + "get_electricity_price_config": { + "constant_price": 0, + "time_of_use_config": { + "summer": { + "midpeak": 0, + "offpeak": 0, + "onpeak": 0, + "period": [ + 0, + 0, + 0, + 0 + ], + "weekday_config": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "weekend_config": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ] + }, + "winter": { + "midpeak": 0, + "offpeak": 0, + "onpeak": 0, + "period": [ + 0, + 0, + 0, + 0 + ], + "weekday_config": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "weekend_config": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ] + } + }, + "type": "constant" + }, + "get_energy_usage": { + "current_power": 0, + "electricity_charge": [ + 0, + 0, + 0 + ], + "local_time": "2024-01-23 00:38:23", + "month_energy": 0, + "month_runtime": 31709, + "today_energy": 0, + "today_runtime": 38 + }, + "get_fw_download_state": { + "auto_upgrade": false, + "download_progress": 0, + "reboot_time": 5, + "status": 0, + "upgrade_time": 5 + }, + "get_latest_fw": { + "fw_size": 0, + "fw_ver": "1.0.2 Build 231108 Rel.163012", + "hw_id": "", + "need_to_upgrade": false, + "oem_id": "", + "release_date": "", + "release_note": "", + "type": 0 + }, + "get_led_info": { + "led_rule": "always", + "led_status": true, + "night_mode": { + "end_time": 436, + "night_mode_type": "sunrise_sunset", + "start_time": 1072, + "sunrise_offset": 0, + "sunset_offset": 0 + } + }, + "get_max_power": { + "max_power": 1885 + }, + "get_next_event": {}, + "get_protection_power": { + "enabled": false, + "protection_power": 0 + }, + "get_schedule_rules": { + "enable": false, + "rule_list": [], + "schedule_rule_max_count": 32, + "start_index": 0, + "sum": 0 + }, + "get_wireless_scan_info": { + "ap_list": [], + "wep_supported": false + }, + "qs_component_nego": { + "component_list": [ + { + "id": "quick_setup", + "ver_code": 3 + }, + { + "id": "sunrise_sunset", + "ver_code": 1 + }, + { + "id": "ble_whole_setup", + "ver_code": 1 + }, + { + "id": "iot_cloud", + "ver_code": 1 + }, + { + "id": "inherit", + "ver_code": 1 + }, + { + "id": "firmware", + "ver_code": 2 + } + ], + "extra_info": { + "device_model": "EP25", + "device_type": "SMART.KASAPLUG", + "is_klap": false + } + } +} diff --git a/kasa/tests/fixtures/smart/L530E(US)_2.0_1.1.0.json b/kasa/tests/fixtures/smart/L530E(US)_2.0_1.1.0.json index 59cbf04e..6dac1048 100644 --- a/kasa/tests/fixtures/smart/L530E(US)_2.0_1.1.0.json +++ b/kasa/tests/fixtures/smart/L530E(US)_2.0_1.1.0.json @@ -145,7 +145,7 @@ "get_device_info": { "avatar": "bulb", "brightness": 100, - "color_temp": 2700, + "color_temp": 0, "color_temp_range": [ 2500, 6500 @@ -154,19 +154,19 @@ "re_power_type": "always_on", "state": { "brightness": 100, - "color_temp": 2700, - "hue": 0, - "saturation": 100 + "color_temp": 0, + "hue": 12, + "saturation": 45 }, "type": "last_states" }, "device_id": "0000000000000000000000000000000000000000", - "device_on": true, + "device_on": false, "dynamic_light_effect_enable": false, "fw_id": "00000000000000000000000000000000", "fw_ver": "1.1.0 Build 230721 Rel.224802", "has_set_location_info": true, - "hue": 0, + "hue": 12, "hw_id": "00000000000000000000000000000000", "hw_ver": "2.0", "ip": "127.0.0.123", @@ -179,8 +179,8 @@ "oem_id": "00000000000000000000000000000000", "overheated": false, "region": "Pacific/Honolulu", - "rssi": -43, - "saturation": 100, + "rssi": -41, + "saturation": 45, "signal_level": 3, "specs": "", "ssid": "I01BU0tFRF9TU0lEIw==", @@ -190,23 +190,23 @@ "get_device_time": { "region": "Pacific/Honolulu", "time_diff": -600, - "timestamp": 1705976485 + "timestamp": 1705991895 }, "get_device_usage": { "power_usage": { - "past30": 1, - "past7": 1, - "today": 1 - }, - "saved_power": { "past30": 2, "past7": 2, "today": 2 }, + "saved_power": { + "past30": 8, + "past7": 8, + "today": 8 + }, "time_usage": { - "past30": 3, - "past7": 3, - "today": 3 + "past30": 10, + "past7": 10, + "today": 10 } }, "get_dynamic_light_effect_rules": { diff --git a/kasa/tests/fixtures/smart/P125M(US)_1.0_1.1.0.json b/kasa/tests/fixtures/smart/P125M(US)_1.0_1.1.0.json index 812cd1ea..78e876d7 100644 --- a/kasa/tests/fixtures/smart/P125M(US)_1.0_1.1.0.json +++ b/kasa/tests/fixtures/smart/P125M(US)_1.0_1.1.0.json @@ -86,7 +86,7 @@ "factory_default": false, "ip": "127.0.0.123", "is_support_iot_cloud": true, - "mac": "00-00-00-00-00-00", + "mac": "48-22-54-00-00-00", "mgt_encrypt_schm": { "encrypt_type": "KLAP", "http_port": 80, @@ -130,21 +130,21 @@ "device_on": true, "fw_id": "00000000000000000000000000000000", "fw_ver": "1.1.0 Build 231009 Rel.155831", - "has_set_location_info": false, + "has_set_location_info": true, "hw_id": "00000000000000000000000000000000", "hw_ver": "1.0", "ip": "127.0.0.123", "lang": "en_US", "latitude": 0, "longitude": 0, - "mac": "00-00-00-00-00-00", + "mac": "48-22-54-00-00-00", "model": "P125M", "nickname": "I01BU0tFRF9OQU1FIw==", "oem_id": "00000000000000000000000000000000", - "on_time": 76, + "on_time": 189479, "overheated": false, "region": "Pacific/Honolulu", - "rssi": -49, + "rssi": -43, "signal_level": 3, "specs": "", "ssid": "I01BU0tFRF9TU0lEIw==", @@ -154,13 +154,13 @@ "get_device_time": { "region": "Pacific/Honolulu", "time_diff": -600, - "timestamp": 1704406945 + "timestamp": 1705991899 }, "get_device_usage": { "time_usage": { - "past30": 16892, - "past7": 4, - "today": 4 + "past30": 3163, + "past7": 3163, + "today": 1238 } }, "get_fw_download_state": { @@ -184,9 +184,9 @@ "led_rule": "always", "led_status": true, "night_mode": { - "end_time": 420, + "end_time": 427, "night_mode_type": "sunrise_sunset", - "start_time": 1140, + "start_time": 1092, "sunrise_offset": 0, "sunset_offset": 0 }