From 8ed972cdb00f7815543e18b3afb0f823a0c66296 Mon Sep 17 00:00:00 2001 From: LiShuzhen Date: Wed, 5 Mar 2025 18:29:02 +0800 Subject: [PATCH] feat: cubee.airrtc.1230t hvac mode --- custom_components/xiaomi_home/miot/miot_spec.py | 16 ++++++++-------- .../xiaomi_home/miot/specs/spec_modify.yaml | 11 +++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/custom_components/xiaomi_home/miot/miot_spec.py b/custom_components/xiaomi_home/miot/miot_spec.py index d2292e8..ef5aeec 100644 --- a/custom_components/xiaomi_home/miot/miot_spec.py +++ b/custom_components/xiaomi_home/miot/miot_spec.py @@ -1453,10 +1453,12 @@ class MIoTSpecParser: key=':'.join(p_type_strs[:5])) or property_['description'] or spec_prop.name) - if 'value-range' in property_: - spec_prop.value_range = property_['value-range'] - elif 'value-list' in property_: - v_list: list[dict] = property_['value-list'] + # Modify value-list before translation + v_list: list[dict] = self._spec_modify.get_prop_value_list( + siid=service['iid'], piid=property_['iid']) + if (v_list is None) and ('value-list' in property_): + v_list = property_['value-list'] + if v_list is not None: for index, v in enumerate(v_list): if v['description'].strip() == '': v['description'] = f'v_{v["value"]}' @@ -1470,6 +1472,8 @@ class MIoTSpecParser: f'{v["description"]}') or v['name']) spec_prop.value_list = MIoTSpecValueList.from_spec(v_list) + if 'value-range' in property_: + spec_prop.value_range = property_['value-range'] elif property_['format'] == 'bool': v_tag = ':'.join(p_type_strs[:5]) v_descriptions = ( @@ -1494,10 +1498,6 @@ class MIoTSpecParser: siid=service['iid'], piid=property_['iid']) if custom_range: spec_prop.value_range = custom_range - custom_list = self._spec_modify.get_prop_value_list( - siid=service['iid'], piid=property_['iid']) - if custom_list: - spec_prop.value_list = custom_list # Parse service event for event in service.get('events', []): if ( diff --git a/custom_components/xiaomi_home/miot/specs/spec_modify.yaml b/custom_components/xiaomi_home/miot/specs/spec_modify.yaml index 58ba8ef..297a6a4 100644 --- a/custom_components/xiaomi_home/miot/specs/spec_modify.yaml +++ b/custom_components/xiaomi_home/miot/specs/spec_modify.yaml @@ -58,3 +58,14 @@ urn:miot-spec-v2:device:bath-heater:0000A028:opple-acmoto:1: description: medium - value: 255 description: high +urn:miot-spec-v2:device:thermostat:0000A031:cubee-1230t:1: + prop.2.4: + value-list: + - value: 0 + description: cool + - value: 1 + description: heat + - value: 2 + description: fan + - value: 3 + description: auto