diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index adcad8e4..182ec765 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,6 +16,10 @@ repos: - id: check-yaml - id: debug-statements - id: check-ast + - id: pretty-format-json + args: + - "--autofix" + - "--indent=4" - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.7.4 diff --git a/tests/fixtures/serialization/deviceconfig_camera-aes-https.json b/tests/fixtures/serialization/deviceconfig_camera-aes-https.json index 361ec6ec..40543d2d 100644 --- a/tests/fixtures/serialization/deviceconfig_camera-aes-https.json +++ b/tests/fixtures/serialization/deviceconfig_camera-aes-https.json @@ -1,9 +1,9 @@ { - "host": "127.0.0.1", - "timeout": 5, "connection_type": { "device_family": "SMART.IPCAMERA", "encryption_type": "AES", "https": true - } + }, + "host": "127.0.0.1", + "timeout": 5 } diff --git a/tests/fixtures/serialization/deviceconfig_plug-klap.json b/tests/fixtures/serialization/deviceconfig_plug-klap.json index fa7a6ba8..f7891802 100644 --- a/tests/fixtures/serialization/deviceconfig_plug-klap.json +++ b/tests/fixtures/serialization/deviceconfig_plug-klap.json @@ -1,10 +1,10 @@ { - "host": "127.0.0.1", - "timeout": 5, "connection_type": { "device_family": "SMART.TAPOPLUG", "encryption_type": "KLAP", "https": false, "login_version": 2 - } + }, + "host": "127.0.0.1", + "timeout": 5 } diff --git a/tests/fixtures/serialization/deviceconfig_plug-xor.json b/tests/fixtures/serialization/deviceconfig_plug-xor.json index 5cb0222a..04e43639 100644 --- a/tests/fixtures/serialization/deviceconfig_plug-xor.json +++ b/tests/fixtures/serialization/deviceconfig_plug-xor.json @@ -1,9 +1,9 @@ { - "host": "127.0.0.1", - "timeout": 5, "connection_type": { "device_family": "IOT.SMARTPLUGSWITCH", "encryption_type": "XOR", "https": false - } + }, + "host": "127.0.0.1", + "timeout": 5 } diff --git a/tests/fixtures/smart/RV20 Max Plus(EU)_1.0_1.0.7.json b/tests/fixtures/smart/RV20 Max Plus(EU)_1.0_1.0.7.json index d312a198..92b8e85b 100644 --- a/tests/fixtures/smart/RV20 Max Plus(EU)_1.0_1.0.7.json +++ b/tests/fixtures/smart/RV20 Max Plus(EU)_1.0_1.0.7.json @@ -150,6 +150,9 @@ "owner": "00000000000000000000000000000000" } }, + "getAreaUnit": { + "area_unit": 0 + }, "getAutoChangeMap": { "auto_change_map": false }, @@ -159,10 +162,16 @@ "getBatteryInfo": { "battery_percentage": 75 }, - "getAreaUnit": {"area_unit": 0}, - "getCleanAttr": {"suction": 2, "cistern": 2, "clean_number": 1}, - "getCleanInfo": {"clean_time": 5, "clean_area": 5, "clean_percent": 1}, - "getCleanStatus": {"getCleanStatus": {"clean_status": 0, "is_working": false, "is_mapping": false, "is_relocating": false}}, + "getCleanAttr": { + "cistern": 2, + "clean_number": 1, + "suction": 2 + }, + "getCleanInfo": { + "clean_area": 5, + "clean_percent": 1, + "clean_time": 5 + }, "getCleanRecords": { "lastest_day_record": [ 0, @@ -176,6 +185,14 @@ "total_number": 0, "total_time": 0 }, + "getCleanStatus": { + "getCleanStatus": { + "clean_status": 0, + "is_mapping": false, + "is_relocating": false, + "is_working": false + } + }, "getConsumablesInfo": { "charge_contact_time": 0, "edge_brush_time": 0, @@ -189,14 +206,15 @@ "name": "2", "version": 1 }, - "getVolume": { - "volume": 84 - }, "getDoNotDisturb": { "do_not_disturb": true, "e_min": 480, "s_min": 1320 }, + "getDustCollectionInfo": { + "auto_dust_collection": true, + "dust_collection_mode": 0 + }, "getMapInfo": { "auto_change_map": false, "current_map_id": 0, @@ -207,10 +225,6 @@ "getMopState": { "mop_state": false }, - "getDustCollectionInfo": { - "auto_dust_collection": true, - "dust_collection_mode": 0 - }, "getVacStatus": { "err_status": [ 0 @@ -222,6 +236,9 @@ "promptCode_id": [], "status": 5 }, + "getVolume": { + "volume": 84 + }, "get_device_info": { "auto_pack_ver": "0.0.1.1771", "avatar": "", diff --git a/tests/fixtures/smart/child/T310(EU)_1.0_1.5.0.json b/tests/fixtures/smart/child/T310(EU)_1.0_1.5.0.json index d48875e5..0d9108ee 100644 --- a/tests/fixtures/smart/child/T310(EU)_1.0_1.5.0.json +++ b/tests/fixtures/smart/child/T310(EU)_1.0_1.5.0.json @@ -1,5 +1,5 @@ { - "component_nego" : { + "component_nego": { "component_list": [ { "id": "device", diff --git a/tests/fixtures/smart/child/T315(EU)_1.0_1.7.0.json b/tests/fixtures/smart/child/T315(EU)_1.0_1.7.0.json index 4fc49b0e..a9fd67e3 100644 --- a/tests/fixtures/smart/child/T315(EU)_1.0_1.7.0.json +++ b/tests/fixtures/smart/child/T315(EU)_1.0_1.7.0.json @@ -1,537 +1,537 @@ { - "component_nego" : { - "component_list" : [ - { - "id" : "device", - "ver_code" : 2 - }, - { - "id" : "quick_setup", - "ver_code" : 3 - }, - { - "id" : "trigger_log", - "ver_code" : 1 - }, - { - "id" : "time", - "ver_code" : 1 - }, - { - "id" : "device_local_time", - "ver_code" : 1 - }, - { - "id" : "account", - "ver_code" : 1 - }, - { - "id" : "synchronize", - "ver_code" : 1 - }, - { - "id" : "cloud_connect", - "ver_code" : 1 - }, - { - "id" : "iot_cloud", - "ver_code" : 1 - }, - { - "id" : "firmware", - "ver_code" : 1 - }, - { - "id" : "localSmart", - "ver_code" : 1 - }, - { - "id" : "battery_detect", - "ver_code" : 1 - }, - { - "id" : "temperature", - "ver_code" : 1 - }, - { - "id" : "humidity", - "ver_code" : 1 - }, - { - "id" : "temp_humidity_record", - "ver_code" : 1 - }, - { - "id" : "comfort_temperature", - "ver_code" : 1 - }, - { - "id" : "comfort_humidity", - "ver_code" : 1 - }, - { - "id" : "report_mode", - "ver_code" : 1 - } - ] - }, - "get_connect_cloud_state" : { - "status" : 0 - }, - "get_device_info" : { - "at_low_battery" : false, - "avatar" : "", - "battery_percentage" : 100, - "bind_count" : 1, - "category" : "subg.trigger.temp-hmdt-sensor", - "current_humidity" : 61, - "current_humidity_exception" : 1, - "current_temp" : 21.4, - "current_temp_exception" : 0, - "device_id" : "SCRUBBED_CHILD_DEVICE_ID_1", - "fw_ver" : "1.7.0 Build 230424 Rel.170332", - "hw_id" : "00000000000000000000000000000000", - "hw_ver" : "1.0", - "jamming_rssi" : -122, - "jamming_signal_level" : 1, - "lastOnboardingTimestamp" : 1706990901, - "mac" : "F0A731000000", - "model" : "T315", - "nickname" : "I01BU0tFRF9OQU1FIw==", - "oem_id" : "00000000000000000000000000000000", - "parent_device_id" : "0000000000000000000000000000000000000000", - "region" : "Europe/Berlin", - "report_interval" : 16, - "rssi" : -56, - "signal_level" : 3, - "specs" : "EU", - "status" : "online", - "status_follow_edge" : false, - "temp_unit" : "celsius", - "type" : "SMART.TAPOSENSOR" - }, - "get_fw_download_state" : { - "cloud_cache_seconds" : 1, - "download_progress" : 0, - "reboot_time" : 5, - "status" : 0, - "upgrade_time" : 5 - }, - "get_latest_fw" : { - "fw_ver" : "1.8.0 Build 230921 Rel.091446", - "hw_id" : "00000000000000000000000000000000", - "need_to_upgrade" : true, - "oem_id" : "00000000000000000000000000000000", - "release_date" : "2023-12-01", - "release_note" : "Modifications and Bug Fixes:\nEnhance the stability of the sensor.", - "type" : 2 - }, - "get_temp_humidity_records" : { - "local_time" : 1709061516, - "past24h_humidity" : [ - 60, - 60, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 58, - 59, - 59, - 58, - 59, - 59, - 59, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 59, - 59, - 59, - 59, - 59, - 59, - 60, - 60, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 59, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 60, - 64, - 56, - 53, - 55, - 56, - 57, - 57, - 58, - 59, - 63, - 63, - 62, - 62, - 62, - 62, - 61, - 62, - 62, - 61, - 61 - ], - "past24h_humidity_exception" : [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 4, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 3, - 3, - 2, - 2, - 2, - 2, - 1, - 2, - 2, - 1, - 1 - ], - "past24h_temp" : [ - 217, - 216, - 215, - 214, - 214, - 214, - 214, - 214, - 214, - 213, - 213, - 213, - 213, - 213, - 212, - 212, - 211, - 211, - 211, - 211, - 211, - 211, - 212, - 212, - 212, - 211, - 211, - 211, - 211, - 212, - 212, - 212, - 212, - 212, - 211, - 211, - 211, - 212, - 213, - 214, - 214, - 214, - 213, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 212, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 213, - 214, - 214, - 215, - 215, - 215, - 214, - 215, - 216, - 216, - 216, - 216, - 216, - 216, - 216, - 205, - 196, - 210, - 213, - 213, - 213, - 213, - 213, - 214, - 215, - 214, - 214, - 213, - 213, - 214, - 214, - 214, - 213, - 213 - ], - "past24h_temp_exception" : [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - -4, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "temp_unit" : "celsius" - }, - "get_trigger_logs" : { - "logs" : [ - { - "event" : "tooDry", - "eventId" : "118040a8-5422-1100-0804-0a8542211000", - "id" : 1, - "timestamp" : 1706996915 - } - ], - "start_id" : 1, - "sum" : 1 - } + "component_nego": { + "component_list": [ + { + "id": "device", + "ver_code": 2 + }, + { + "id": "quick_setup", + "ver_code": 3 + }, + { + "id": "trigger_log", + "ver_code": 1 + }, + { + "id": "time", + "ver_code": 1 + }, + { + "id": "device_local_time", + "ver_code": 1 + }, + { + "id": "account", + "ver_code": 1 + }, + { + "id": "synchronize", + "ver_code": 1 + }, + { + "id": "cloud_connect", + "ver_code": 1 + }, + { + "id": "iot_cloud", + "ver_code": 1 + }, + { + "id": "firmware", + "ver_code": 1 + }, + { + "id": "localSmart", + "ver_code": 1 + }, + { + "id": "battery_detect", + "ver_code": 1 + }, + { + "id": "temperature", + "ver_code": 1 + }, + { + "id": "humidity", + "ver_code": 1 + }, + { + "id": "temp_humidity_record", + "ver_code": 1 + }, + { + "id": "comfort_temperature", + "ver_code": 1 + }, + { + "id": "comfort_humidity", + "ver_code": 1 + }, + { + "id": "report_mode", + "ver_code": 1 + } + ] + }, + "get_connect_cloud_state": { + "status": 0 + }, + "get_device_info": { + "at_low_battery": false, + "avatar": "", + "battery_percentage": 100, + "bind_count": 1, + "category": "subg.trigger.temp-hmdt-sensor", + "current_humidity": 61, + "current_humidity_exception": 1, + "current_temp": 21.4, + "current_temp_exception": 0, + "device_id": "SCRUBBED_CHILD_DEVICE_ID_1", + "fw_ver": "1.7.0 Build 230424 Rel.170332", + "hw_id": "00000000000000000000000000000000", + "hw_ver": "1.0", + "jamming_rssi": -122, + "jamming_signal_level": 1, + "lastOnboardingTimestamp": 1706990901, + "mac": "F0A731000000", + "model": "T315", + "nickname": "I01BU0tFRF9OQU1FIw==", + "oem_id": "00000000000000000000000000000000", + "parent_device_id": "0000000000000000000000000000000000000000", + "region": "Europe/Berlin", + "report_interval": 16, + "rssi": -56, + "signal_level": 3, + "specs": "EU", + "status": "online", + "status_follow_edge": false, + "temp_unit": "celsius", + "type": "SMART.TAPOSENSOR" + }, + "get_fw_download_state": { + "cloud_cache_seconds": 1, + "download_progress": 0, + "reboot_time": 5, + "status": 0, + "upgrade_time": 5 + }, + "get_latest_fw": { + "fw_ver": "1.8.0 Build 230921 Rel.091446", + "hw_id": "00000000000000000000000000000000", + "need_to_upgrade": true, + "oem_id": "00000000000000000000000000000000", + "release_date": "2023-12-01", + "release_note": "Modifications and Bug Fixes:\nEnhance the stability of the sensor.", + "type": 2 + }, + "get_temp_humidity_records": { + "local_time": 1709061516, + "past24h_humidity": [ + 60, + 60, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 58, + 59, + 59, + 58, + 59, + 59, + 59, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 59, + 59, + 59, + 59, + 59, + 59, + 60, + 60, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 59, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 60, + 64, + 56, + 53, + 55, + 56, + 57, + 57, + 58, + 59, + 63, + 63, + 62, + 62, + 62, + 62, + 61, + 62, + 62, + 61, + 61 + ], + "past24h_humidity_exception": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3, + 3, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 1, + 1 + ], + "past24h_temp": [ + 217, + 216, + 215, + 214, + 214, + 214, + 214, + 214, + 214, + 213, + 213, + 213, + 213, + 213, + 212, + 212, + 211, + 211, + 211, + 211, + 211, + 211, + 212, + 212, + 212, + 211, + 211, + 211, + 211, + 212, + 212, + 212, + 212, + 212, + 211, + 211, + 211, + 212, + 213, + 214, + 214, + 214, + 213, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 212, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 213, + 214, + 214, + 215, + 215, + 215, + 214, + 215, + 216, + 216, + 216, + 216, + 216, + 216, + 216, + 205, + 196, + 210, + 213, + 213, + 213, + 213, + 213, + 214, + 215, + 214, + 214, + 213, + 213, + 214, + 214, + 214, + 213, + 213 + ], + "past24h_temp_exception": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + -4, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "temp_unit": "celsius" + }, + "get_trigger_logs": { + "logs": [ + { + "event": "tooDry", + "eventId": "118040a8-5422-1100-0804-0a8542211000", + "id": 1, + "timestamp": 1706996915 + } + ], + "start_id": 1, + "sum": 1 + } }