From 7e359ee7b5c600daf2790518de0e693c24b12a11 Mon Sep 17 00:00:00 2001 From: ptbsare <496725701@qq.com> Date: Tue, 26 Mar 2024 20:12:36 +0800 Subject: [PATCH 1/2] Improve viomi.fridge.m1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 提升获取更多设备厂商可获取的属性以供使用。 例如:viomi.fridge.m1 的Indoortemp属性代表室内温度,可供获取到冰箱所在室内的温度以供使用,如此用户可以省掉一个温度传感器。 --- custom_components/xiaomi_miot/core/miio2miot_specs.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/custom_components/xiaomi_miot/core/miio2miot_specs.py b/custom_components/xiaomi_miot/core/miio2miot_specs.py index fff952e20..65532532b 100644 --- a/custom_components/xiaomi_miot/core/miio2miot_specs.py +++ b/custom_components/xiaomi_miot/core/miio2miot_specs.py @@ -1243,13 +1243,9 @@ def cbk(prop, params, props, **kwargs): # ["Mode","RCSetTemp","FCSetTemp","RCSet","Error","IndoorTemp","SmartCool","SmartFreeze"] # ["none",8 ,-15 ,"on" ,0 ,30 ,"off" ,"off"] # 'chunk_properties': 8, - 'miio_commands': [ - { - 'method': 'get_prop', - 'params': ['RCSetTemp','FCSetTemp', 'RCSet', 'ScreenOn', 'Error', 'SmartCool', 'SmartFreeze', 'IndoorTemp'], - 'values': ['RCSetTemp','FCSetTemp', 'RCSet', 'ScreenOn', 'Error', 'SmartCool', 'SmartFreeze', 'IndoorTemp'], - }, - ], + 'chunk_properties': 1, + 'miio_props': ['ScreenOn', 'Error', 'SmartCool', 'SmartFreeze', 'IndoorTemp'], + 'entity_attrs': ['ScreenOn', 'Error', 'SmartCool', 'SmartFreeze', 'IndoorTemp'], 'miio_specs': { 'prop.2.1': {'prop': 'Mode', 'setter': 'setMode', 'dict': { 'smart': 1, From 42d0fff5d01e1d1e207c492d7ff8c153721a5b4d Mon Sep 17 00:00:00 2001 From: ptbsare <496725701@qq.com> Date: Wed, 27 Mar 2024 20:00:19 +0800 Subject: [PATCH 2/2] add Indoor Temp sensor entity for viomi.fridge.m1 --- .../xiaomi_miot/core/device_customizes.py | 3 +++ .../xiaomi_miot/core/miio2miot_specs.py | 5 +++-- .../xiaomi_miot/core/miot_specs_extend.json | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index bf39e46b4..73c93121d 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1271,6 +1271,9 @@ 2: 0, # Descent-limit }, }, + 'viomi.fridge.m1': { + 'sensor_properties': 'fridge.temperature', + }, 'viomi.hood.v1': { 'main_miot_services': 'hood-2', 'number_properties': 'off_delay_time', diff --git a/custom_components/xiaomi_miot/core/miio2miot_specs.py b/custom_components/xiaomi_miot/core/miio2miot_specs.py index 65532532b..3051a5bcb 100644 --- a/custom_components/xiaomi_miot/core/miio2miot_specs.py +++ b/custom_components/xiaomi_miot/core/miio2miot_specs.py @@ -1244,8 +1244,8 @@ def cbk(prop, params, props, **kwargs): # ["none",8 ,-15 ,"on" ,0 ,30 ,"off" ,"off"] # 'chunk_properties': 8, 'chunk_properties': 1, - 'miio_props': ['ScreenOn', 'Error', 'SmartCool', 'SmartFreeze', 'IndoorTemp'], - 'entity_attrs': ['ScreenOn', 'Error', 'SmartCool', 'SmartFreeze', 'IndoorTemp'], + 'miio_props': ['ScreenOn', 'Error', 'SmartCool', 'SmartFreeze'], + 'entity_attrs': ['ScreenOn', 'Error', 'SmartCool', 'SmartFreeze'], 'miio_specs': { 'prop.2.1': {'prop': 'Mode', 'setter': 'setMode', 'dict': { 'smart': 1, @@ -1258,6 +1258,7 @@ def cbk(prop, params, props, **kwargs): 'prop.3.3': {'prop': 'RCSetTemp'}, 'prop.4.1': {'prop': 'FCSetTemp', 'setter': 'setFCSetTemp'}, 'prop.4.2': {'prop': 'FCSetTemp'}, + 'prop.2.2': {'prop': 'IndoorTemp'}, }, }, 'viomi.juicer.v1': { diff --git a/custom_components/xiaomi_miot/core/miot_specs_extend.json b/custom_components/xiaomi_miot/core/miot_specs_extend.json index 77a3d5386..53d0582b0 100644 --- a/custom_components/xiaomi_miot/core/miot_specs_extend.json +++ b/custom_components/xiaomi_miot/core/miot_specs_extend.json @@ -766,6 +766,22 @@ ] } ], + "viomi.fridge.m1": [ + { + "iid": 2, + "properties": [ + { + "iid": 2, + "type": "urn:miot-spec-v2:property:temperature", + "description": "Indoor Temperature", + "format": "float", + "access": ["read"], + "unit": "celsius", + "value-range": [-40, 125, 1] + } + ] + } + ], "viomi.vacuum.v7": [ {