From c938c3622c87a43de21007df09f9e07f2d0efff3 Mon Sep 17 00:00:00 2001 From: Alone Date: Fri, 24 May 2024 11:41:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=AA=AD=20improve=20for=20zhimi.fan.za3/za?= =?UTF-8?q?4=20(#1686)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xiaomi_miot/core/device_customizes.py | 6 ++++++ custom_components/xiaomi_miot/core/miio2miot_specs.py | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/custom_components/xiaomi_miot/core/device_customizes.py b/custom_components/xiaomi_miot/core/device_customizes.py index c10763565..df11c1bb7 100644 --- a/custom_components/xiaomi_miot/core/device_customizes.py +++ b/custom_components/xiaomi_miot/core/device_customizes.py @@ -1624,6 +1624,12 @@ 'brightness_for_on': 0, 'brightness_for_off': 2, }, + 'zhimi.fan.za3': { + 'miot_type': 'urn:miot-spec-v2:device:fan:0000A005:zhimi-za3:3', + }, + 'zhimi.fan.za4': { + 'miot_type': 'urn:miot-spec-v2:device:fan:0000A005:zhimi-za4:3', + }, 'zhimi.fan.*': { 'switch_properties': 'anion,alarm,horizontal_swing,vertical_swing', 'number_properties': 'horizontal_angle,vertical_angle,off_delay', diff --git a/custom_components/xiaomi_miot/core/miio2miot_specs.py b/custom_components/xiaomi_miot/core/miio2miot_specs.py index f8c78260b..20fc6f5d3 100644 --- a/custom_components/xiaomi_miot/core/miio2miot_specs.py +++ b/custom_components/xiaomi_miot/core/miio2miot_specs.py @@ -2754,6 +2754,16 @@ def cbk(prop, params, props, **kwargs): 'template': '{{ 1 if value|int(0) > 0 else 0 }}', 'set_template': '{{ [value|int(0) * 25] }}', }, + 'prop.2.6': { + 'prop': 'speed_level', + 'setter': True, + 'template': '{{ props.natural_level|default(value,true)|int(0) }}', + 'set_template': '{% set nlv = props.natural_level|default(0)|int(0) %}' + '{{ {' + '"method": "set_natural_level" if nlv else "set_speed_level",' + '"params": [value|int(0)],' + '} }}', + }, 'prop.4.1': { 'prop': 'buzzer', 'setter': True,