From d7295bdf6dc53b9332dbb0f7c18930e86dba49d2 Mon Sep 17 00:00:00 2001 From: gritstub Date: Tue, 28 Jun 2022 04:06:34 -0700 Subject: [PATCH] Add fixtures for ES20M (#353) (#354) Co-authored-by: Teemu R --- README.md | 1 + kasa/tests/conftest.py | 2 +- kasa/tests/fixtures/ES20M(US)_1.0_1.0.8.json | 126 +++++++++++++++++++ 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 kasa/tests/fixtures/ES20M(US)_1.0_1.0.8.json diff --git a/README.md b/README.md index 6c2d543a..edcb7da6 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ or the `parse_pcap.py` script contained inside the `devtools` directory. ### Wall switches +* ES20M * HS200 * HS210 * HS220 diff --git a/kasa/tests/conftest.py b/kasa/tests/conftest.py index da8dbce0..721efa85 100644 --- a/kasa/tests/conftest.py +++ b/kasa/tests/conftest.py @@ -55,7 +55,7 @@ PLUGS = { "KP401", } STRIPS = {"HS107", "HS300", "KP303", "KP400", "EP40"} -DIMMERS = {"HS220", "KS220M", "KS230"} +DIMMERS = {"ES20M", "HS220", "KS220M", "KS230"} DIMMABLE = {*BULBS, *DIMMERS} WITH_EMETER = {"HS110", "HS300", "KP115", "KP125", *BULBS} diff --git a/kasa/tests/fixtures/ES20M(US)_1.0_1.0.8.json b/kasa/tests/fixtures/ES20M(US)_1.0_1.0.8.json new file mode 100644 index 00000000..bb316b83 --- /dev/null +++ b/kasa/tests/fixtures/ES20M(US)_1.0_1.0.8.json @@ -0,0 +1,126 @@ +{ + "smartlife.iot.LAS": { + "get_config": { + "devs": [ + { + "dark_index": 0, + "enable": 1, + "hw_id": 0, + "level_array": [ + { + "adc": 367, + "name": "cloudy", + "value": 14 + }, + { + "adc": 300, + "name": "overcast", + "value": 12 + }, + { + "adc": 222, + "name": "dawn", + "value": 9 + }, + { + "adc": 222, + "name": "twilight", + "value": 9 + }, + { + "adc": 111, + "name": "total darkness", + "value": 4 + }, + { + "adc": 2400, + "name": "custom", + "value": 97 + } + ], + "max_adc": 2450, + "min_adc": 0 + } + ], + "err_code": 0, + "ver": "1.0" + } + }, + "smartlife.iot.PIR": { + "get_config": { + "array": [ + 80, + 50, + 20, + 0 + ], + "cold_time": 600000, + "enable": 1, + "err_code": 0, + "max_adc": 4095, + "min_adc": 0, + "trigger_index": 0, + "version": "1.0" + } + }, + "smartlife.iot.dimmer": { + "get_dimmer_parameters": { + "bulb_type": 1, + "err_code": 0, + "fadeOffTime": 2000, + "fadeOnTime": 1000, + "gentleOffTime": 10000, + "gentleOnTime": 3000, + "minThreshold": 14, + "rampRate": 30 + } + }, + "system": { + "get_sysinfo": { + "active_mode": "none", + "alias": "Test ES20M", + "brightness": 35, + "dev_name": "Wi-Fi Smart Dimmer with sensor", + "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": "00:00:00:00:00:00", + "mic_type": "IOT.SMARTPLUGSWITCH", + "model": "ES20M(US)", + "next_action": { + "type": -1 + }, + "oemId": "00000000000000000000000000000000", + "on_time": 0, + "preferred_state": [ + { + "brightness": 100, + "index": 0 + }, + { + "brightness": 75, + "index": 1 + }, + { + "brightness": 50, + "index": 2 + }, + { + "brightness": 25, + "index": 3 + } + ], + "relay_state": 0, + "rssi": -59, + "status": "new", + "sw_ver": "1.0.8 Build 211201 Rel.123822", + "updating": 0 + } + } +}