mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-19 00:20:44 +08:00
feat: yeelink.light.ceiling19 ambient light
This commit is contained in:
parent
11ab0290f1
commit
38296132a6
@ -1080,6 +1080,8 @@ class SpecCustomService:
|
|||||||
return spec
|
return spec
|
||||||
if 'services' not in spec:
|
if 'services' not in spec:
|
||||||
return spec
|
return spec
|
||||||
|
if isinstance(self._data[urn_key], str):
|
||||||
|
urn_key = self._data[urn_key]
|
||||||
spec_services = spec['services']
|
spec_services = spec['services']
|
||||||
custom_spec = self._data.get(urn_key, None)
|
custom_spec = self._data.get(urn_key, None)
|
||||||
# Replace services by custom defined spec
|
# Replace services by custom defined spec
|
||||||
|
|||||||
@ -56,6 +56,77 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"urn:miot-spec-v2:device:light:0000A001:yeelink-ceiling19": "urn:miot-spec-v2:device:light:0000A001:yeelink-ceiling4",
|
||||||
|
"urn:miot-spec-v2:device:light:0000A001:yeelink-ceiling20": "urn:miot-spec-v2:device:light:0000A001:yeelink-ceiling4",
|
||||||
|
"urn:miot-spec-v2:device:light:0000A001:yeelink-ceiling4": {
|
||||||
|
"new": [
|
||||||
|
{
|
||||||
|
"iid": 200,
|
||||||
|
"type": "urn:miot-spec-v2:service:ambient-light:0000789D:yeelink-ceiling4:1",
|
||||||
|
"description": "Ambient Light",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"iid": 201,
|
||||||
|
"type": "urn:miot-spec-v2:property:on:00000006:yeelink-ceiling4:1",
|
||||||
|
"description": "Switch Status",
|
||||||
|
"format": "bool",
|
||||||
|
"access": [
|
||||||
|
"read",
|
||||||
|
"write"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"iid": 202,
|
||||||
|
"type": "urn:miot-spec-v2:property:brightness:0000000D:yeelink-ceiling4:1",
|
||||||
|
"description": "Brightness",
|
||||||
|
"format": "uint8",
|
||||||
|
"access": [
|
||||||
|
"read",
|
||||||
|
"write"
|
||||||
|
],
|
||||||
|
"unit": "percentage",
|
||||||
|
"value-range": [
|
||||||
|
1,
|
||||||
|
100,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"iid": 203,
|
||||||
|
"type": "urn:miot-spec-v2:property:color-temperature:0000000F:yeelink-ceiling4:1",
|
||||||
|
"description": "Color Temperature",
|
||||||
|
"format": "uint32",
|
||||||
|
"access": [
|
||||||
|
"read",
|
||||||
|
"write"
|
||||||
|
],
|
||||||
|
"unit": "kelvin",
|
||||||
|
"value-range": [
|
||||||
|
1700,
|
||||||
|
6500,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"iid": 204,
|
||||||
|
"type": "urn:miot-spec-v2:property:color:0000000E:yeelink-ceiling4:1",
|
||||||
|
"description": "Color",
|
||||||
|
"format": "uint32",
|
||||||
|
"access": [
|
||||||
|
"read",
|
||||||
|
"write"
|
||||||
|
],
|
||||||
|
"unit": "rgb",
|
||||||
|
"value-range": [
|
||||||
|
1,
|
||||||
|
16777215,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"urn:miot-spec-v2:device:water-heater:0000A02A:zimi-h03": {
|
"urn:miot-spec-v2:device:water-heater:0000A02A:zimi-h03": {
|
||||||
"new": [
|
"new": [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -203,12 +203,21 @@ def is_integer(s: str) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def custom_service(d: dict) -> bool:
|
def custom_service(d: dict) -> bool:
|
||||||
"""restricted format: dict[str, dict[str, Any]]"""
|
"""restricted format: dict[str, dict[str, Any]] or dict[str, str]"""
|
||||||
if not dict_str_dict(d):
|
if not isinstance(d, dict):
|
||||||
return False
|
return False
|
||||||
|
for k, v in d.items():
|
||||||
|
if not isinstance(k, str):
|
||||||
|
return False
|
||||||
|
if not (isinstance(v, dict) or isinstance(v, str)):
|
||||||
|
return False
|
||||||
if not urn_key(d, CUSTOM_SERVICE_URN_KEY_COLON_NUM):
|
if not urn_key(d, CUSTOM_SERVICE_URN_KEY_COLON_NUM):
|
||||||
return False
|
return False
|
||||||
for v in d.values():
|
for v in d.values():
|
||||||
|
if isinstance(v, str):
|
||||||
|
if CUSTOM_SERVICE_URN_KEY_COLON_NUM != v.count(':'):
|
||||||
|
return False
|
||||||
|
continue
|
||||||
for key, value in v.items():
|
for key, value in v.items():
|
||||||
if key=='new':
|
if key=='new':
|
||||||
if not isinstance(value, list):
|
if not isinstance(value, list):
|
||||||
@ -312,7 +321,10 @@ def sort_custom_service(file_path: str):
|
|||||||
service_data: dict = load_json_file(file_path=file_path)
|
service_data: dict = load_json_file(file_path=file_path)
|
||||||
service_data = dict(sorted(service_data.items()))
|
service_data = dict(sorted(service_data.items()))
|
||||||
for urn, spec in service_data.items():
|
for urn, spec in service_data.items():
|
||||||
service_data[urn] = dict(sorted(spec.items()))
|
if isinstance(spec, dict):
|
||||||
|
service_data[urn] = dict(sorted(spec.items()))
|
||||||
|
else:
|
||||||
|
service_data[urn] = spec
|
||||||
return service_data
|
return service_data
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user