mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-05-28 21:24:41 +08:00
Fix specs (#1110)
* fix: the power consumption, the voltage and the current of lxzn.switch.cbcsmj * fix: the fan direction of shhf.light.sfla10 * fix: the door state value-list description in Chinese of loock.lock.t2pv1 * fix: the stepless fan level of zhimi.fan.za4 * fix: the stepless fan level of zhimi.fan.sa1
This commit is contained in:
parent
a83ad60b38
commit
23cc1130fe
@ -1,4 +1,10 @@
|
|||||||
{
|
{
|
||||||
|
"urn:miot-spec-v2:device:bath-heater:0000A028:yeelink-v10": {
|
||||||
|
"en": {
|
||||||
|
"service:003:property:001:valuelist:000": "Idle",
|
||||||
|
"service:003:property:001:valuelist:001": "Dry"
|
||||||
|
}
|
||||||
|
},
|
||||||
"urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1": {
|
"urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1": {
|
||||||
"de": {
|
"de": {
|
||||||
"service:001": "Geräteinformationen",
|
"service:001": "Geräteinformationen",
|
||||||
@ -155,6 +161,26 @@
|
|||||||
"service:004:property:001": "事件名稱"
|
"service:004:property:001": "事件名稱"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"urn:miot-spec-v2:device:lock:0000A038:loock-t2pv1": {
|
||||||
|
"zh-Hans": {
|
||||||
|
"service:003:property:1021:valuelist:000": "已上锁",
|
||||||
|
"service:003:property:1021:valuelist:001": "已上锁(童锁)",
|
||||||
|
"service:003:property:1021:valuelist:002": "已上锁(反锁)",
|
||||||
|
"service:003:property:1021:valuelist:003": "已上锁(反锁+童锁)",
|
||||||
|
"service:003:property:1021:valuelist:004": "已开锁",
|
||||||
|
"service:003:property:1021:valuelist:008": "门未关(门超时未关)",
|
||||||
|
"service:003:property:1021:valuelist:012": "门虚掩"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"urn:miot-spec-v2:device:plant-monitor:0000A030:hhcc-v1": {
|
||||||
|
"en": {
|
||||||
|
"service:002:property:001": "Soil Moisture"
|
||||||
|
},
|
||||||
|
"zh-Hans": {
|
||||||
|
"service:002:property:001": "土壤湿度",
|
||||||
|
"service:002:property:003": "光照强度"
|
||||||
|
}
|
||||||
|
},
|
||||||
"urn:miot-spec-v2:device:switch:0000A003:lumi-acn040": {
|
"urn:miot-spec-v2:device:switch:0000A003:lumi-acn040": {
|
||||||
"en": {
|
"en": {
|
||||||
"service:011": "Right Button On and Off",
|
"service:011": "Right Button On and Off",
|
||||||
@ -168,20 +194,5 @@
|
|||||||
"service:016:action:001": "中键确认",
|
"service:016:action:001": "中键确认",
|
||||||
"service:017:action:001": "右键确认"
|
"service:017:action:001": "右键确认"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"urn:miot-spec-v2:device:bath-heater:0000A028:yeelink-v10": {
|
|
||||||
"en": {
|
|
||||||
"service:003:property:001:valuelist:000": "Idle",
|
|
||||||
"service:003:property:001:valuelist:001": "Dry"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"urn:miot-spec-v2:device:plant-monitor:0000A030:hhcc-v1": {
|
|
||||||
"en": {
|
|
||||||
"service:002:property:001": "Soil Moisture"
|
|
||||||
},
|
|
||||||
"zh-Hans": {
|
|
||||||
"service:002:property:001": "土壤湿度",
|
|
||||||
"service:002:property:003": "光照强度"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -48,13 +48,19 @@ urn:miot-spec-v2:device:bath-heater:0000A028:xiaomi-s1:1:
|
|||||||
prop.4.4:
|
prop.4.4:
|
||||||
name: fan-level-ventilation
|
name: fan-level-ventilation
|
||||||
urn:miot-spec-v2:device:fan:0000A005:dmaker-p5:1:
|
urn:miot-spec-v2:device:fan:0000A005:dmaker-p5:1:
|
||||||
prop.2.6:
|
prop.2.4:
|
||||||
name: fan-level-a
|
name: fan-level-a
|
||||||
urn:miot-spec-v2:device:fan:0000A005:xiaomi-p51:1:
|
urn:miot-spec-v2:device:fan:0000A005:xiaomi-p51:1:
|
||||||
prop.2.2:
|
prop.2.2:
|
||||||
name: fan-level-a
|
name: fan-level-a
|
||||||
|
urn:miot-spec-v2:device:fan:0000A005:zhimi-sa1:3:
|
||||||
|
prop.2.2:
|
||||||
|
name: fan-level-a
|
||||||
urn:miot-spec-v2:device:fan:0000A005:zhimi-v3:3:
|
urn:miot-spec-v2:device:fan:0000A005:zhimi-v3:3:
|
||||||
prop.2.6:
|
prop.2.2:
|
||||||
|
name: fan-level-a
|
||||||
|
urn:miot-spec-v2:device:fan:0000A005:zhimi-za4:3:
|
||||||
|
prop.2.2:
|
||||||
name: fan-level-a
|
name: fan-level-a
|
||||||
urn:miot-spec-v2:device:gateway:0000A019:lumi-mcn001:1:
|
urn:miot-spec-v2:device:gateway:0000A019:lumi-mcn001:1:
|
||||||
prop.2.1:
|
prop.2.1:
|
||||||
@ -90,6 +96,9 @@ urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:3: urn:miot-spec-v2:device:
|
|||||||
urn:miot-spec-v2:device:kettle:0000A009:yunmi-r3:1:
|
urn:miot-spec-v2:device:kettle:0000A009:yunmi-r3:1:
|
||||||
prop.3.1:
|
prop.3.1:
|
||||||
unit: ppm
|
unit: ppm
|
||||||
|
urn:miot-spec-v2:device:light:0000A001:shhf-sfla10:1:
|
||||||
|
prop.8.9:
|
||||||
|
name: wind-reverse
|
||||||
urn:miot-spec-v2:device:light:0000A001:shhf-sfla12:1:
|
urn:miot-spec-v2:device:light:0000A001:shhf-sfla12:1:
|
||||||
prop.8.11:
|
prop.8.11:
|
||||||
name: on-a
|
name: on-a
|
||||||
@ -172,6 +181,13 @@ urn:miot-spec-v2:device:safe-box:0000A042:loock-v1:1:
|
|||||||
prop.5.1:
|
prop.5.1:
|
||||||
name: contact-state
|
name: contact-state
|
||||||
expr: src_value!=1
|
expr: src_value!=1
|
||||||
|
urn:miot-spec-v2:device:switch:0000A003:lxzn-cbcsmj:1:0000D00D:
|
||||||
|
prop.3.1:
|
||||||
|
expr: round(src_value/100, 2)
|
||||||
|
prop.3.2:
|
||||||
|
expr: round(src_value/1000, 2)
|
||||||
|
prop.3.3:
|
||||||
|
expr: round(src_value/10, 1)
|
||||||
urn:miot-spec-v2:device:thermostat:0000A031:suittc-wk168:1:
|
urn:miot-spec-v2:device:thermostat:0000A031:suittc-wk168:1:
|
||||||
prop.2.3:
|
prop.2.3:
|
||||||
value-list:
|
value-list:
|
||||||
|
@ -353,7 +353,7 @@ instance code 为 MIoT-Spec-V2 实例代码,格式如下:
|
|||||||
```
|
```
|
||||||
service:<siid> # 服务
|
service:<siid> # 服务
|
||||||
service:<siid>:property:<piid> # 属性
|
service:<siid>:property:<piid> # 属性
|
||||||
service:<siid>:property:<piid>:valuelist:<value> # 属性取值列表的值
|
service:<siid>:property:<piid>:valuelist:<value> # 属性取值列表的索引值
|
||||||
service:<siid>:event:<eiid> # 事件
|
service:<siid>:event:<eiid> # 事件
|
||||||
service:<siid>:action:<aiid> # 方法
|
service:<siid>:action:<aiid> # 方法
|
||||||
```
|
```
|
||||||
|
@ -18,6 +18,8 @@ SPEC_BOOL_TRANS_FILE = path.join(
|
|||||||
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/bool_trans.yaml')
|
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/bool_trans.yaml')
|
||||||
SPEC_FILTER_FILE = path.join(
|
SPEC_FILTER_FILE = path.join(
|
||||||
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/spec_filter.yaml')
|
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/spec_filter.yaml')
|
||||||
|
SPEC_MULTI_LANG_FILE = path.join(
|
||||||
|
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/multi_lang.json')
|
||||||
SPEC_ADD_FILE = path.join(
|
SPEC_ADD_FILE = path.join(
|
||||||
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/spec_add.json')
|
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/spec_add.json')
|
||||||
SPEC_MODIFY_FILE = path.join(
|
SPEC_MODIFY_FILE = path.join(
|
||||||
@ -140,6 +142,14 @@ def bool_trans(d: dict) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def multi_lang(data: dict) -> bool:
|
||||||
|
"""dict[str, dict[str, dict[str, str]]]"""
|
||||||
|
for key in data.keys():
|
||||||
|
if key.count(':') != 5:
|
||||||
|
return False
|
||||||
|
return nested_3_dict_str_str(data)
|
||||||
|
|
||||||
|
|
||||||
def spec_add(data: dict) -> bool:
|
def spec_add(data: dict) -> bool:
|
||||||
"""dict[str, list[dict[str, int| str | list]]]"""
|
"""dict[str, list[dict[str, int| str | list]]]"""
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
@ -304,6 +314,10 @@ def sort_spec_add(file_path: str):
|
|||||||
return dict(sorted(filter_data.items()))
|
return dict(sorted(filter_data.items()))
|
||||||
|
|
||||||
|
|
||||||
|
def sort_multi_lang(file_path: str):
|
||||||
|
return sort_spec_add(file_path)
|
||||||
|
|
||||||
|
|
||||||
def sort_spec_modify(file_path: str):
|
def sort_spec_modify(file_path: str):
|
||||||
filter_data = load_yaml_file(file_path=file_path)
|
filter_data = load_yaml_file(file_path=file_path)
|
||||||
assert isinstance(filter_data, dict), f'{file_path} format error'
|
assert isinstance(filter_data, dict), f'{file_path} format error'
|
||||||
@ -326,6 +340,14 @@ def test_spec_filter():
|
|||||||
assert spec_filter(data), f'{SPEC_FILTER_FILE} format error'
|
assert spec_filter(data), f'{SPEC_FILTER_FILE} format error'
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.github
|
||||||
|
def test_multi_lang():
|
||||||
|
data = load_json_file(SPEC_MULTI_LANG_FILE)
|
||||||
|
assert isinstance(data, dict)
|
||||||
|
assert data, f'load {SPEC_MULTI_LANG_FILE} failed'
|
||||||
|
assert multi_lang(data), f'{SPEC_MULTI_LANG_FILE} format error'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.github
|
@pytest.mark.github
|
||||||
def test_spec_add():
|
def test_spec_add():
|
||||||
data = load_json_file(SPEC_ADD_FILE)
|
data = load_json_file(SPEC_ADD_FILE)
|
||||||
@ -418,6 +440,12 @@ def test_miot_data_sort():
|
|||||||
f'{SPEC_FILTER_FILE} not sorted, goto project root path'
|
f'{SPEC_FILTER_FILE} not sorted, goto project root path'
|
||||||
' and run the following command sorting, ',
|
' and run the following command sorting, ',
|
||||||
'pytest -s -v -m update ./test/check_rule_format.py')
|
'pytest -s -v -m update ./test/check_rule_format.py')
|
||||||
|
assert json.dumps(
|
||||||
|
load_json_file(file_path=SPEC_MULTI_LANG_FILE)) == json.dumps(
|
||||||
|
sort_multi_lang(file_path=SPEC_MULTI_LANG_FILE)), (
|
||||||
|
f'{SPEC_MULTI_LANG_FILE} not sorted, goto project root path'
|
||||||
|
' and run the following command sorting, ',
|
||||||
|
'pytest -s -v -m update ./test/check_rule_format.py')
|
||||||
assert json.dumps(load_json_file(file_path=SPEC_ADD_FILE)) == json.dumps(
|
assert json.dumps(load_json_file(file_path=SPEC_ADD_FILE)) == json.dumps(
|
||||||
sort_spec_add(file_path=SPEC_ADD_FILE)), (
|
sort_spec_add(file_path=SPEC_ADD_FILE)), (
|
||||||
f'{SPEC_ADD_FILE} not sorted, goto project root path'
|
f'{SPEC_ADD_FILE} not sorted, goto project root path'
|
||||||
@ -438,6 +466,8 @@ def test_sort_spec_data():
|
|||||||
sort_data = sort_spec_filter(file_path=SPEC_FILTER_FILE)
|
sort_data = sort_spec_filter(file_path=SPEC_FILTER_FILE)
|
||||||
save_yaml_file(file_path=SPEC_FILTER_FILE, data=sort_data)
|
save_yaml_file(file_path=SPEC_FILTER_FILE, data=sort_data)
|
||||||
_LOGGER.info('%s formatted.', SPEC_FILTER_FILE)
|
_LOGGER.info('%s formatted.', SPEC_FILTER_FILE)
|
||||||
|
sort_data = sort_multi_lang(file_path=SPEC_MULTI_LANG_FILE)
|
||||||
|
save_json_file(file_path=SPEC_MULTI_LANG_FILE, data=sort_data)
|
||||||
sort_data = sort_spec_add(file_path=SPEC_ADD_FILE)
|
sort_data = sort_spec_add(file_path=SPEC_ADD_FILE)
|
||||||
save_json_file(file_path=SPEC_ADD_FILE, data=sort_data)
|
save_json_file(file_path=SPEC_ADD_FILE, data=sort_data)
|
||||||
_LOGGER.info('%s formatted.', SPEC_ADD_FILE)
|
_LOGGER.info('%s formatted.', SPEC_ADD_FILE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user