From 412e9bb0729b30c6a3cf915b6a8771089e28e7e4 Mon Sep 17 00:00:00 2001 From: Luke Lashley Date: Wed, 8 May 2024 18:16:48 -0400 Subject: [PATCH] Add test data for Zeo and Dyad devices to Roborock (#117054) --- homeassistant/components/roborock/__init__.py | 2 + tests/components/roborock/mock_data.py | 701 +++++++++++++++++- 2 files changed, 701 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/roborock/__init__.py b/homeassistant/components/roborock/__init__.py index 12a884dba48..d7ce0e0f5ec 100644 --- a/homeassistant/components/roborock/__init__.py +++ b/homeassistant/components/roborock/__init__.py @@ -9,6 +9,7 @@ import logging from typing import Any from roborock import HomeDataRoom, RoborockException, RoborockInvalidCredentials +from roborock.code_mappings import RoborockCategory from roborock.containers import DeviceData, HomeDataDevice, HomeDataProduct, UserData from roborock.version_1_apis.roborock_mqtt_client_v1 import RoborockMqttClientV1 from roborock.web_api import RoborockApiClient @@ -96,6 +97,7 @@ def build_setup_functions( hass, user_data, device, product_info[device.product_id], home_data_rooms ) for device in device_map.values() + if product_info[device.product_id].category == RoborockCategory.VACUUM ] diff --git a/tests/components/roborock/mock_data.py b/tests/components/roborock/mock_data.py index 16ebc8806f9..6e3fb229aa9 100644 --- a/tests/components/roborock/mock_data.py +++ b/tests/components/roborock/mock_data.py @@ -224,7 +224,599 @@ HOME_DATA_RAW = { "desc": None, }, ], - } + }, + { + "id": "dyad_product", + "name": "Roborock Dyad Pro", + "model": "roborock.wetdryvac.a56", + "category": "roborock.wetdryvac", + "capability": 2, + "schema": [ + { + "id": "134", + "name": "烘干状态", + "code": "drying_status", + "mode": "ro", + "type": "RAW", + }, + { + "id": "200", + "name": "启停", + "code": "start", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "201", + "name": "状态", + "code": "status", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "202", + "name": "自清洁模式", + "code": "self_clean_mode", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "203", + "name": "自清洁强度", + "code": "self_clean_level", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "204", + "name": "烘干强度", + "code": "warm_level", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "205", + "name": "洗地模式", + "code": "clean_mode", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "206", + "name": "吸力", + "code": "suction", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "207", + "name": "水量", + "code": "water_level", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "208", + "name": "滚刷转速", + "code": "brush_speed", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "209", + "name": "电量", + "code": "power", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "210", + "name": "预约时间", + "code": "countdown_time", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "212", + "name": "自动自清洁", + "code": "auto_self_clean_set", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "213", + "name": "自动烘干", + "code": "auto_dry", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "214", + "name": "滤网已工作时间", + "code": "mesh_left", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "215", + "name": "滚刷已工作时间", + "code": "brush_left", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "216", + "name": "错误值", + "code": "error", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "218", + "name": "滤网重置", + "code": "mesh_reset", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "219", + "name": "滚刷重置", + "code": "brush_reset", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "221", + "name": "音量", + "code": "volume_set", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "222", + "name": "直立解锁自动运行开关", + "code": "stand_lock_auto_run", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "223", + "name": "自动自清洁 - 模式", + "code": "auto_self_clean_set_mode", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "224", + "name": "自动烘干 - 模式", + "code": "auto_dry_mode", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "225", + "name": "静音烘干时长", + "code": "silent_dry_duration", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "226", + "name": "勿扰模式开关", + "code": "silent_mode", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "227", + "name": "勿扰开启时间", + "code": "silent_mode_start_time", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "228", + "name": "勿扰结束时间", + "code": "silent_mode_end_time", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "229", + "name": "近30天每天洗地时长", + "code": "recent_run_time", + "mode": "rw", + "type": "STRING", + }, + { + "id": "230", + "name": "洗地总时长", + "code": "total_run_time", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "235", + "name": "featureinfo", + "code": "feature_info", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "236", + "name": "恢复初始设置", + "code": "recover_settings", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "237", + "name": "烘干倒计时", + "code": "dry_countdown", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "10000", + "name": "ID点数据查询", + "code": "id_query", + "mode": "rw", + "type": "STRING", + }, + { + "id": "10001", + "name": "防串货", + "code": "f_c", + "mode": "ro", + "type": "STRING", + }, + { + "id": "10002", + "name": "定时任务", + "code": "schedule_task", + "mode": "rw", + "type": "STRING", + }, + { + "id": "10003", + "name": "语音包切换", + "code": "snd_switch", + "mode": "rw", + "type": "STRING", + }, + { + "id": "10004", + "name": "语音包/OBA信息", + "code": "snd_state", + "mode": "rw", + "type": "STRING", + }, + { + "id": "10005", + "name": "产品信息", + "code": "product_info", + "mode": "ro", + "type": "STRING", + }, + { + "id": "10006", + "name": "隐私协议", + "code": "privacy_info", + "mode": "rw", + "type": "STRING", + }, + { + "id": "10007", + "name": "OTA info", + "code": "ota_nfo", + "mode": "ro", + "type": "STRING", + }, + { + "id": "10101", + "name": "rpc req", + "code": "rpc_req", + "mode": "wo", + "type": "STRING", + }, + { + "id": "10102", + "name": "rpc resp", + "code": "rpc_resp", + "mode": "ro", + "type": "STRING", + }, + ], + }, + { + "id": "zeo_id", + "name": "Zeo One", + "model": "roborock.wm.a102", + "category": "roborock.wm", + "capability": 2, + "schema": [ + { + "id": "134", + "name": "烘干状态", + "code": "drying_status", + "mode": "ro", + "type": "RAW", + }, + { + "id": "200", + "name": "启动", + "code": "start", + "mode": "rw", + "type": "BOOL", + }, + { + "id": "201", + "name": "暂停", + "code": "pause", + "mode": "rw", + "type": "BOOL", + }, + { + "id": "202", + "name": "关机", + "code": "shutdown", + "mode": "rw", + "type": "BOOL", + }, + { + "id": "203", + "name": "状态", + "code": "status", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "204", + "name": "模式", + "code": "mode", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "205", + "name": "程序", + "code": "program", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "206", + "name": "童锁", + "code": "child_lock", + "mode": "rw", + "type": "BOOL", + }, + { + "id": "207", + "name": "洗涤温度", + "code": "temp", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "208", + "name": "漂洗次数", + "code": "rinse_times", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "209", + "name": "滚筒转速", + "code": "spin_level", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "210", + "name": "干燥度", + "code": "drying_mode", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "211", + "name": "自动投放-洗衣液", + "code": "detergent_set", + "mode": "rw", + "type": "BOOL", + }, + { + "id": "212", + "name": "自动投放-柔顺剂", + "code": "softener_set", + "mode": "rw", + "type": "BOOL", + }, + { + "id": "213", + "name": "洗衣液投放量", + "code": "detergent_type", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "214", + "name": "柔顺剂投放量", + "code": "softener_type", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "217", + "name": "预约时间", + "code": "countdown", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "218", + "name": "洗衣剩余时间", + "code": "washing_left", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "219", + "name": "门锁状态", + "code": "doorlock_state", + "mode": "ro", + "type": "BOOL", + }, + { + "id": "220", + "name": "故障", + "code": "error", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "221", + "name": "云程序设置", + "code": "custom_param_save", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "222", + "name": "云程序读取", + "code": "custom_param_get", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "223", + "name": "提示音", + "code": "sound_set", + "mode": "rw", + "type": "BOOL", + }, + { + "id": "224", + "name": "距离上次筒自洁次数", + "code": "times_after_clean", + "mode": "ro", + "type": "VALUE", + }, + { + "id": "225", + "name": "记忆洗衣偏好开关", + "code": "default_setting", + "mode": "rw", + "type": "BOOL", + }, + { + "id": "226", + "name": "洗衣液用尽", + "code": "detergent_empty", + "mode": "ro", + "type": "BOOL", + }, + { + "id": "227", + "name": "柔顺剂用尽", + "code": "softener_empty", + "mode": "ro", + "type": "BOOL", + }, + { + "id": "229", + "name": "筒灯设定", + "code": "light_setting", + "mode": "rw", + "type": "BOOL", + }, + { + "id": "230", + "name": "洗衣液投放量(单次)", + "code": "detergent_volume", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "231", + "name": "柔顺剂投放量(单次)", + "code": "softener_volume", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "232", + "name": "远程控制授权", + "code": "app_authorization", + "mode": "rw", + "type": "VALUE", + }, + { + "id": "10000", + "name": "ID点查询", + "code": "id_query", + "mode": "rw", + "type": "STRING", + }, + { + "id": "10001", + "name": "防串货", + "code": "f_c", + "mode": "ro", + "type": "STRING", + }, + { + "id": "10004", + "name": "语音包/OBA信息", + "code": "snd_state", + "mode": "rw", + "type": "STRING", + }, + { + "id": "10005", + "name": "产品信息", + "code": "product_info", + "mode": "ro", + "type": "STRING", + }, + { + "id": "10006", + "name": "隐私协议", + "code": "privacy_info", + "mode": "rw", + "type": "STRING", + }, + { + "id": "10007", + "name": "OTA info", + "code": "ota_nfo", + "mode": "rw", + "type": "STRING", + }, + { + "id": "10008", + "name": "洗衣记录", + "code": "washing_log", + "mode": "ro", + "type": "BOOL", + }, + { + "id": "10101", + "name": "rpc req", + "code": "rpc_req", + "mode": "wo", + "type": "STRING", + }, + { + "id": "10102", + "name": "rpc resp", + "code": "rpc_resp", + "mode": "ro", + "type": "STRING", + }, + ], + }, ], "devices": [ { @@ -304,7 +896,112 @@ HOME_DATA_RAW = { "silentOtaSwitch": True, }, ], - "receivedDevices": [], + "receivedDevices": [ + { + "duid": "dyad_duid", + "name": "Dyad Pro", + "localKey": "abc", + "fv": "01.12.34", + "productId": "dyad_product", + "activeTime": 1700754026, + "timeZoneId": "Europe/Stockholm", + "iconUrl": "", + "share": True, + "shareTime": 1701367095, + "online": True, + "pv": "A01", + "tuyaMigrated": False, + "deviceStatus": { + "10002": "", + "202": 0, + "235": 0, + "214": 513, + "225": 360, + "212": 1, + "228": 360, + "209": 100, + "10001": '{"f":"t"}', + "237": 0, + "10007": '{"mqttOtaData":{"mqttOtaStatus":{"status":"IDLE"}}}', + "227": 1320, + "10005": '{"sn":"dyad_sn","ssid":"dyad_ssid","timezone":"Europe/Stockholm","posix_timezone":"CET-1CEST,M3.5.0,M10.5.0/3","ip":"1.123.12.1","mac":"b0:4a:33:33:33:33","oba":{"language":"en","name":"A.03.0291_CE","bom":"A.03.0291","location":"de","wifiplan":"EU","timezone":"CET-1CEST,M3.5.0,M10.5.0/3;Europe/Berlin","logserver":"awsde0","featureset":"0"}"}', + "213": 1, + "207": 4, + "10004": '{"sid_in_use":25,"sid_version":5,"location":"de","bom":"A.03.0291","language":"en"}', + "206": 3, + "216": 0, + "221": 100, + "222": 0, + "223": 2, + "203": 2, + "230": 352, + "205": 1, + "210": 0, + "200": 0, + "226": 0, + "208": 1, + "229": "000,000,003,000,005,000,000,000,003,000,005,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,012,003,000,000", + "201": 3, + "215": 513, + "204": 1, + "224": 1, + }, + "silentOtaSwitch": False, + "f": False, + }, + { + "duid": "zeo_duid", + "name": "Zeo One", + "localKey": "zeo_local_key", + "fv": "01.00.94", + "productId": "zeo_id", + "activeTime": 1699964128, + "timeZoneId": "Europe/Berlin", + "iconUrl": "", + "share": True, + "shareTime": 1712763572, + "online": True, + "pv": "A01", + "tuyaMigrated": False, + "sn": "zeo_sn", + "featureSet": "0", + "newFeatureSet": "40", + "deviceStatus": { + "208": 2, + "205": 33, + "221": 0, + "226": 0, + "10001": '{"f":"t"}', + "214": 2, + "225": 0, + "232": 0, + "222": 347414, + "206": 0, + "200": 1, + "219": 0, + "223": 0, + "220": 0, + "201": 0, + "202": 1, + "10005": '{"sn":"zeo_sn","ssid":"internet","timezone":"Europe/Berlin","posix_timezone":"CET-1CEST,M3.5.0,M10.5.0/3","ip":"192.111.11.11","mac":"b0:4a:00:00:00:00","rssi":-57,"oba":{"language":"en","name":"A.03.0403_CE","bom":"A.03.0403","location":"de","wifiplan":"EU","timezone":"CET-1CEST,M3.5.0,M10.5.0/3;Europe/Berlin","logserver":"awsde0","loglevel":"4","featureset":"0"}}', + "211": 1, + "210": 1, + "217": 0, + "203": 7, + "213": 2, + "209": 7, + "224": 21, + "218": 227, + "212": 1, + "207": 4, + "204": 1, + "10007": '{"mqttOtaData":{"mqttOtaStatus":{"status":"IDLE"}}}', + "227": 1, + }, + "silentOtaSwitch": False, + "f": False, + }, + ], "rooms": [ {"id": 2362048, "name": "Example room 1"}, {"id": 2362044, "name": "Example room 2"},