From e94cd118a4b21fafa00adffb48e73dcfd3a34944 Mon Sep 17 00:00:00 2001 From: Steven B <51370195+sdb9696@users.noreply.github.com> Date: Sat, 20 Jan 2024 12:22:54 +0000 Subject: [PATCH] Add fixtures with new MAC mask (#661) --- kasa/tests/conftest.py | 2 +- kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json | 28 ++ kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json | 6 +- kasa/tests/fixtures/KP105(UK)_1.0_1.0.5.json | 36 +++ kasa/tests/fixtures/KP105(UK)_1.0_1.0.7.json | 8 +- .../fixtures/smart/L510B(EU)_3.0_1.0.5.json | 263 ++++++++++++++++++ .../fixtures/smart/L530E(EU)_3.0_1.1.0.json | 24 +- .../smart/L900-10(EU)_1.0_1.0.17.json | 20 +- .../fixtures/smart/P110(UK)_1.0_1.3.0.json | 62 ++--- 9 files changed, 388 insertions(+), 61 deletions(-) create mode 100644 kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json create mode 100644 kasa/tests/fixtures/KP105(UK)_1.0_1.0.5.json create mode 100644 kasa/tests/fixtures/smart/L510B(EU)_3.0_1.0.5.json diff --git a/kasa/tests/conftest.py b/kasa/tests/conftest.py index dc244402..4aae4035 100644 --- a/kasa/tests/conftest.py +++ b/kasa/tests/conftest.py @@ -46,7 +46,7 @@ SUPPORTED_DEVICES = SUPPORTED_IOT_DEVICES + SUPPORTED_SMART_DEVICES BULBS_SMART_VARIABLE_TEMP = {"L530E"} BULBS_SMART_LIGHT_STRIP = {"L900-5", "L900-10", "L920-5"} BULBS_SMART_COLOR = {"L530E", *BULBS_SMART_LIGHT_STRIP} -BULBS_SMART_DIMMABLE = {"KS225"} +BULBS_SMART_DIMMABLE = {"KS225", "L510B"} BULBS_SMART = ( BULBS_SMART_VARIABLE_TEMP.union(BULBS_SMART_COLOR) .union(BULBS_SMART_DIMMABLE) diff --git a/kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json b/kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json new file mode 100644 index 00000000..fd98bd08 --- /dev/null +++ b/kasa/tests/fixtures/HS100(UK)_1.0_1.2.6.json @@ -0,0 +1,28 @@ +{ + "system": { + "get_sysinfo": { + "active_mode": "schedule", + "alias": "#MASKED_NAME#", + "dev_name": "Wi-Fi Smart Plug", + "deviceId": "0000000000000000000000000000000000000000", + "err_code": 0, + "feature": "TIM", + "fwId": "00000000000000000000000000000000", + "hwId": "00000000000000000000000000000000", + "hw_ver": "1.0", + "icon_hash": "", + "latitude": 0, + "led_off": 0, + "longitude": 0, + "mac": "70:4F:57:00:00:00", + "model": "HS100(UK)", + "oemId": "00000000000000000000000000000000", + "on_time": 0, + "relay_state": 0, + "rssi": -59, + "sw_ver": "1.2.6 Build 200727 Rel.120236", + "type": "IOT.SMARTPLUGSWITCH", + "updating": 0 + } + } +} diff --git a/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json b/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json index 7caf6aeb..6e33fd7d 100644 --- a/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json +++ b/kasa/tests/fixtures/HS100(UK)_4.1_1.1.0.json @@ -6,7 +6,7 @@ "factory_default": true, "hw_ver": "4.1", "ip": "127.0.0.123", - "mac": "00-00-00-00-00-00", + "mac": "CC-32-E5-00-00-00", "mgt_encrypt_schm": { "encrypt_type": "KLAP", "http_port": 80, @@ -28,7 +28,7 @@ "latitude_i": 0, "led_off": 0, "longitude_i": 0, - "mac": "00:00:00:00:00:00", + "mac": "CC:32:E5:00:00:00", "mic_type": "IOT.SMARTPLUGSWITCH", "model": "HS100(UK)", "next_action": { @@ -38,7 +38,7 @@ "oemId": "00000000000000000000000000000000", "on_time": 0, "relay_state": 0, - "rssi": -66, + "rssi": -43, "status": "new", "sw_ver": "1.1.0 Build 201016 Rel.175121", "updating": 0 diff --git a/kasa/tests/fixtures/KP105(UK)_1.0_1.0.5.json b/kasa/tests/fixtures/KP105(UK)_1.0_1.0.5.json new file mode 100644 index 00000000..71ec3b7b --- /dev/null +++ b/kasa/tests/fixtures/KP105(UK)_1.0_1.0.5.json @@ -0,0 +1,36 @@ +{ + "system": { + "get_sysinfo": { + "active_mode": "schedule", + "alias": "#MASKED_NAME#", + "dev_name": "Smart Wi-Fi Plug", + "deviceId": "0000000000000000000000000000000000000000", + "err_code": 0, + "feature": "TIM", + "hwId": "00000000000000000000000000000000", + "hw_ver": "1.0", + "icon_hash": "", + "latitude_i": 0, + "led_off": 0, + "longitude_i": 0, + "mac": "D8:47:32:00:00:00", + "mic_type": "IOT.SMARTPLUGSWITCH", + "model": "KP105(UK)", + "next_action": { + "action": 1, + "id": "8AA75A50A8440B17941D192BD9E01FFA", + "schd_sec": 59160, + "type": 1 + }, + "ntc_state": 0, + "obd_src": "tplink", + "oemId": "00000000000000000000000000000000", + "on_time": 0, + "relay_state": 0, + "rssi": -66, + "status": "configured", + "sw_ver": "1.0.5 Build 191209 Rel.094735", + "updating": 0 + } + } +} diff --git a/kasa/tests/fixtures/KP105(UK)_1.0_1.0.7.json b/kasa/tests/fixtures/KP105(UK)_1.0_1.0.7.json index b4a12131..a66dc903 100644 --- a/kasa/tests/fixtures/KP105(UK)_1.0_1.0.7.json +++ b/kasa/tests/fixtures/KP105(UK)_1.0_1.0.7.json @@ -2,7 +2,7 @@ "system": { "get_sysinfo": { "active_mode": "none", - "alias": "Uk plug", + "alias": "#MASKED_NAME#", "dev_name": "Smart Wi-Fi Plug", "deviceId": "0000000000000000000000000000000000000000", "err_code": 0, @@ -13,7 +13,7 @@ "latitude_i": 0, "led_off": 0, "longitude_i": 0, - "mac": "00:00:00:00:00:00", + "mac": "D8:47:32:00:00:00", "mic_type": "IOT.SMARTPLUGSWITCH", "model": "KP105(UK)", "next_action": { @@ -24,8 +24,8 @@ "oemId": "00000000000000000000000000000000", "on_time": 0, "relay_state": 0, - "rssi": -48, - "status": "new", + "rssi": -67, + "status": "configured", "sw_ver": "1.0.7 Build 210506 Rel.153510", "updating": 0 } diff --git a/kasa/tests/fixtures/smart/L510B(EU)_3.0_1.0.5.json b/kasa/tests/fixtures/smart/L510B(EU)_3.0_1.0.5.json new file mode 100644 index 00000000..a53e93bb --- /dev/null +++ b/kasa/tests/fixtures/smart/L510B(EU)_3.0_1.0.5.json @@ -0,0 +1,263 @@ +{ + "component_nego": { + "component_list": [ + { + "id": "device", + "ver_code": 2 + }, + { + "id": "firmware", + "ver_code": 2 + }, + { + "id": "quick_setup", + "ver_code": 3 + }, + { + "id": "inherit", + "ver_code": 1 + }, + { + "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": "brightness", + "ver_code": 1 + }, + { + "id": "cloud_connect", + "ver_code": 1 + }, + { + "id": "default_states", + "ver_code": 1 + }, + { + "id": "preset", + "ver_code": 1 + }, + { + "id": "device_local_time", + "ver_code": 1 + }, + { + "id": "iot_cloud", + "ver_code": 1 + }, + { + "id": "bulb_quick_control", + "ver_code": 1 + } + ] + }, + "discovery_result": { + "device_id": "00000000000000000000000000000000", + "device_model": "L510B(EU)", + "device_type": "SMART.TAPOBULB", + "factory_default": false, + "ip": "127.0.0.123", + "is_support_iot_cloud": true, + "mac": "5C-E9-31-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_update_info": { + "enable": false, + "random_range": 120, + "time": 180 + }, + "get_connect_cloud_state": { + "status": 0 + }, + "get_countdown_rules": { + "countdown_rule_max_count": 1, + "enable": false, + "rule_list": [] + }, + "get_device_info": { + "avatar": "bulb", + "brightness": 100, + "color_temp_range": [ + 2700, + 2700 + ], + "default_states": { + "brightness": { + "type": "last_states", + "value": 100 + }, + "re_power_type": "always_on" + }, + "device_id": "0000000000000000000000000000000000000000", + "device_on": false, + "fw_id": "00000000000000000000000000000000", + "fw_ver": "1.0.5 Build 230529 Rel.113426", + "has_set_location_info": true, + "hw_id": "00000000000000000000000000000000", + "hw_ver": "3.0", + "ip": "127.0.0.123", + "lang": "en_US", + "latitude": 0, + "longitude": 0, + "mac": "5C-E9-31-00-00-00", + "model": "L510", + "music_rhythm_enable": false, + "music_rhythm_mode": "single_lamp", + "nickname": "I01BU0tFRF9OQU1FIw==", + "oem_id": "00000000000000000000000000000000", + "overheated": false, + "region": "Europe/London", + "rssi": -72, + "signal_level": 1, + "specs": "", + "ssid": "I01BU0tFRF9TU0lEIw==", + "time_diff": 0, + "type": "SMART.TAPOBULB" + }, + "get_device_time": { + "region": "Europe/London", + "time_diff": 0, + "timestamp": 1705744435 + }, + "get_device_usage": { + "power_usage": { + "past30": 0, + "past7": 0, + "today": 0 + }, + "saved_power": { + "past30": 1, + "past7": 1, + "today": 1 + }, + "time_usage": { + "past30": 1, + "past7": 1, + "today": 1 + } + }, + "get_fw_download_state": { + "auto_upgrade": false, + "download_progress": 0, + "reboot_time": 5, + "status": 0, + "upgrade_time": 5 + }, + "get_inherit_info": null, + "get_latest_fw": { + "fw_size": 786432, + "fw_ver": "1.1.2 Build 231120 Rel.201048", + "hw_id": "00000000000000000000000000000000", + "need_to_upgrade": true, + "oem_id": "00000000000000000000000000000000", + "release_date": "2023-12-04", + "release_note": "Modifications and Bug Fixes:\n1. Added the support for setting the Fade In time manually.\n2. Optimized Wi-Fi connection stability\n3. Enhanced local communication security.\n4. Fixed some minor bugs.", + "type": 1 + }, + "get_next_event": {}, + "get_preset_rules": { + "brightness": [ + 1, + 25, + 50, + 75, + 100 + ] + }, + "get_schedule_rules": { + "enable": false, + "rule_list": [], + "schedule_rule_max_count": 32, + "start_index": 0, + "sum": 0 + }, + "get_wireless_scan_info": { + "ap_list": [ + { + "bssid": "000000000000", + "channel": 0, + "cipher_type": 2, + "key_type": "wpa2_psk", + "signal_level": 2, + "ssid": "I01BU0tFRF9TU0lEIw==" + }, + { + "bssid": "000000000000", + "channel": 0, + "cipher_type": 2, + "key_type": "wpa2_psk", + "signal_level": 1, + "ssid": "I01BU0tFRF9TU0lEIw==" + } + ], + "wep_supported": false + }, + "qs_component_nego": { + "component_list": [ + { + "id": "quick_setup", + "ver_code": 3 + }, + { + "id": "sunrise_sunset", + "ver_code": 1 + }, + { + "id": "inherit", + "ver_code": 1 + }, + { + "id": "iot_cloud", + "ver_code": 1 + }, + { + "id": "firmware", + "ver_code": 2 + } + ], + "extra_info": { + "device_model": "L510", + "device_type": "SMART.TAPOBULB" + } + } +} diff --git a/kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.0.json b/kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.0.json index db3e3849..b5b90d32 100644 --- a/kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.0.json +++ b/kasa/tests/fixtures/smart/L530E(EU)_3.0_1.1.0.json @@ -110,7 +110,7 @@ "factory_default": false, "ip": "127.0.0.123", "is_support_iot_cloud": true, - "mac": "00-00-00-00-00-00", + "mac": "5C-E9-31-00-00-00", "mgt_encrypt_schm": { "encrypt_type": "KLAP", "http_port": 80, @@ -144,7 +144,7 @@ }, "get_device_info": { "avatar": "bulb", - "brightness": 50, + "brightness": 100, "color_temp": 2700, "color_temp_range": [ 2500, @@ -153,7 +153,7 @@ "default_states": { "re_power_type": "last_states", "state": { - "brightness": 50, + "brightness": 100, "color_temp": 2700, "hue": 0, "saturation": 100 @@ -173,13 +173,13 @@ "lang": "en_US", "latitude": 0, "longitude": 0, - "mac": "00-00-00-00-00-00", + "mac": "5C-E9-31-00-00-00", "model": "L530", "nickname": "I01BU0tFRF9OQU1FIw==", "oem_id": "00000000000000000000000000000000", "overheated": false, "region": "Europe/London", - "rssi": -70, + "rssi": -79, "saturation": 100, "signal_level": 1, "specs": "", @@ -190,22 +190,22 @@ "get_device_time": { "region": "Europe/London", "time_diff": 0, - "timestamp": 1703934078 + "timestamp": 1705742727 }, "get_device_usage": { "power_usage": { - "past30": 221, - "past7": 54, + "past30": 140, + "past7": 0, "today": 0 }, "saved_power": { - "past30": 1452, - "past7": 503, + "past30": 1198, + "past7": 0, "today": 0 }, "time_usage": { - "past30": 1673, - "past7": 557, + "past30": 1338, + "past7": 0, "today": 0 } }, diff --git a/kasa/tests/fixtures/smart/L900-10(EU)_1.0_1.0.17.json b/kasa/tests/fixtures/smart/L900-10(EU)_1.0_1.0.17.json index 2900accf..5d05bc94 100644 --- a/kasa/tests/fixtures/smart/L900-10(EU)_1.0_1.0.17.json +++ b/kasa/tests/fixtures/smart/L900-10(EU)_1.0_1.0.17.json @@ -110,7 +110,7 @@ "factory_default": false, "ip": "127.0.0.123", "is_support_iot_cloud": true, - "mac": "00-00-00-00-00-00", + "mac": "F0-A7-31-00-00-00", "mgt_encrypt_schm": { "encrypt_type": "AES", "http_port": 80, @@ -191,7 +191,7 @@ "name": "Sunset" }, "longitude": 0, - "mac": "00-00-00-00-00-00", + "mac": "F0-A7-31-00-00-00", "model": "L900", "music_rhythm_enable": false, "music_rhythm_mode": "single_lamp", @@ -199,7 +199,7 @@ "oem_id": "00000000000000000000000000000000", "overheated": false, "region": "Europe/London", - "rssi": -58, + "rssi": -60, "saturation": 96, "signal_level": 2, "specs": "", @@ -210,22 +210,22 @@ "get_device_time": { "region": "Europe/London", "time_diff": 0, - "timestamp": 1704909087 + "timestamp": 1705742728 }, "get_device_usage": { "power_usage": { - "past30": 15, - "past7": 0, + "past30": 94, + "past7": 79, "today": 0 }, "saved_power": { - "past30": 69, - "past7": 1, + "past30": 434, + "past7": 365, "today": 0 }, "time_usage": { - "past30": 84, - "past7": 1, + "past30": 528, + "past7": 444, "today": 0 } }, diff --git a/kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json b/kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json index 22deff8c..339c5fb2 100644 --- a/kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json +++ b/kasa/tests/fixtures/smart/P110(UK)_1.0_1.3.0.json @@ -94,7 +94,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, @@ -137,7 +137,7 @@ ] }, "get_current_power": { - "current_power": 11 + "current_power": 0 }, "get_device_info": { "auto_off_remain_time": 0, @@ -148,7 +148,7 @@ "type": "last_states" }, "device_id": "0000000000000000000000000000000000000000", - "device_on": true, + "device_on": false, "fw_id": "00000000000000000000000000000000", "fw_ver": "1.3.0 Build 230905 Rel.152200", "has_set_location_info": true, @@ -158,17 +158,17 @@ "lang": "en_US", "latitude": 0, "longitude": 0, - "mac": "00-00-00-00-00-00", + "mac": "48-22-54-00-00-00", "model": "P110", "nickname": "I01BU0tFRF9OQU1FIw==", "oem_id": "00000000000000000000000000000000", - "on_time": 3087, + "on_time": 0, "overcurrent_status": "normal", "overheated": false, "power_protection_status": "normal", "region": "Europe/London", - "rssi": -50, - "signal_level": 2, + "rssi": -45, + "signal_level": 3, "specs": "", "ssid": "I01BU0tFRF9TU0lEIw==", "time_diff": 0, @@ -177,23 +177,23 @@ "get_device_time": { "region": "Europe/London", "time_diff": 0, - "timestamp": 1703934043 + "timestamp": 1705742730 }, "get_device_usage": { "power_usage": { - "past30": 2090, - "past7": 1171, - "today": 9 + "past30": 3205, + "past7": 0, + "today": 0 }, "saved_power": { - "past30": 31616, - "past7": 5033, - "today": 42 + "past30": 26000, + "past7": 7265, + "today": 3 }, "time_usage": { - "past30": 33706, - "past7": 6204, - "today": 51 + "past30": 29205, + "past7": 7265, + "today": 3 } }, "get_electricity_price_config": { @@ -329,17 +329,17 @@ "type": "constant" }, "get_energy_usage": { - "current_power": 11300, + "current_power": 0, "electricity_charge": [ 0, 0, 0 ], - "local_time": "2023-12-30 11:00:43", - "month_energy": 2090, - "month_runtime": 33706, - "today_energy": 9, - "today_runtime": 51 + "local_time": "2024-01-20 09:25:31", + "month_energy": 1421, + "month_runtime": 19742, + "today_energy": 0, + "today_runtime": 3 }, "get_fw_download_state": { "auto_upgrade": false, @@ -360,17 +360,17 @@ }, "get_led_info": { "led_rule": "night_mode", - "led_status": true, + "led_status": false, "night_mode": { - "end_time": 550, + "end_time": 538, "night_mode_type": "sunrise_sunset", - "start_time": 961, + "start_time": 989, "sunrise_offset": 62, "sunset_offset": 0 } }, "get_max_power": { - "max_power": 3342 + "max_power": 3379 }, "get_next_event": { "desired_states": { @@ -378,7 +378,7 @@ }, "e_time": 0, "id": "S1", - "s_time": 1703937000, + "s_time": 1705751400, "type": 1 }, "get_protection_power": { @@ -389,7 +389,7 @@ "enable": true, "rule_list": [ { - "day": 30, + "day": 20, "desired_states": { "on": true }, @@ -399,12 +399,12 @@ "enable": true, "id": "S1", "mode": "repeat", - "month": 12, + "month": 1, "s_min": 710, "s_type": "normal", "time_offset": 0, "week_day": 127, - "year": 2023 + "year": 2024 } ], "schedule_rule_max_count": 32,