Skip to content

Commit 028399c

Browse files
authored
fix: tofan.airrtc.wk01 thermostat and air conditioner service (#1160)
1 parent 5179e97 commit 028399c

4 files changed

Lines changed: 179 additions & 2 deletions

File tree

custom_components/xiaomi_home/miot/miot_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,11 +629,14 @@ async def set_prop_async(
629629
mips = self._mips_local.get(device_gw['group_id'], None)
630630
if mips is None:
631631
_LOGGER.error(
632-
'no gw route, %s, try control through cloud',
632+
'no gateway route, %s, try control through cloud',
633633
device_gw)
634634
else:
635635
result = await mips.set_prop_async(
636636
did=did, siid=siid, piid=piid, value=value)
637+
_LOGGER.debug(
638+
'gateway set prop, %s.%d.%d, %s -> %s',
639+
did, siid, piid, value, result)
637640
rc = (result or {}).get(
638641
'code', MIoTErrorCode.CODE_MIPS_INVALID_RESULT.value)
639642
if rc in [0, 1]:
@@ -663,7 +666,7 @@ async def set_prop_async(
663666
{'did': did, 'siid': siid, 'piid': piid, 'value': value}
664667
])
665668
_LOGGER.debug(
666-
'set prop response, %s.%d.%d, %s, result, %s',
669+
'cloud set prop, %s.%d.%d, %s -> %s',
667670
did, siid, piid, value, result)
668671
if result and len(result) == 1:
669672
rc = result[0].get(

custom_components/xiaomi_home/miot/specs/multi_lang.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,17 @@
261261
"service:004:property:007": "минимальная температура цели "
262262
}
263263
},
264+
"urn:miot-spec-v2:device:thermostat:0000A031:tofan-wk01": {
265+
"en": {
266+
"service:002": "Thermostat",
267+
"service:002:property:002": "Air Conditioner Mode",
268+
"service:004": "Air Conditioner"
269+
},
270+
"zh_cn": {
271+
"service:002": "地暖",
272+
"service:004": "空调"
273+
}
274+
},
264275
"urn:miot-spec-v2:device:vacuum:0000A006:ijai-v1": {
265276
"zh_cn": {
266277
"service:007:property:005:valuelist:000": "安静",

custom_components/xiaomi_home/miot/specs/spec_add.json

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,165 @@
1919
]
2020
}
2121
],
22+
"urn:miot-spec-v2:device:thermostat:0000A031:tofan-wk01:1:0000C822": [
23+
{
24+
"iid": 2,
25+
"type": "urn:miot-spec-v2:service:thermostat:0000784A:tofan-wk01:1",
26+
"description": "Thermostat",
27+
"properties": [
28+
{
29+
"iid": 1,
30+
"type": "urn:miot-spec-v2:property:on:00000006:tofan-wk01:1",
31+
"description": "Switch Status",
32+
"format": "bool",
33+
"access": [
34+
"read",
35+
"write",
36+
"notify"
37+
]
38+
},
39+
{
40+
"iid": 2,
41+
"type": "urn:miot-spec-v2:property:mode-a:00000008:tofan-wk01:1",
42+
"description": "Mode",
43+
"format": "uint8",
44+
"access": [
45+
"read",
46+
"write",
47+
"notify"
48+
],
49+
"value-list": [
50+
{
51+
"value": 0,
52+
"description": "Auto"
53+
},
54+
{
55+
"value": 1,
56+
"description": "Cool"
57+
},
58+
{
59+
"value": 2,
60+
"description": "Heat"
61+
},
62+
{
63+
"value": 3,
64+
"description": "Fan"
65+
},
66+
{
67+
"value": 4,
68+
"description": "Dry"
69+
}
70+
]
71+
},
72+
{
73+
"iid": 3,
74+
"type": "urn:miot-spec-v2:property:fault:00000009:tofan-wk01:1",
75+
"description": "Device Fault",
76+
"format": "uint8",
77+
"access": [
78+
"read",
79+
"notify"
80+
],
81+
"value-list": [
82+
{
83+
"value": 0,
84+
"description": "No Faults"
85+
}
86+
]
87+
},
88+
{
89+
"iid": 4,
90+
"type": "urn:miot-spec-v2:property:target-temperature:00000021:tofan-wk01:1",
91+
"description": "Target Temperature",
92+
"format": "uint8",
93+
"access": [
94+
"read",
95+
"write",
96+
"notify"
97+
],
98+
"unit": "celsius",
99+
"value-range": [
100+
16,
101+
35,
102+
1
103+
]
104+
}
105+
],
106+
"actions": [
107+
{
108+
"iid": 1,
109+
"type": "urn:miot-spec-v2:action:toggle:00002811:tofan-wk01:1",
110+
"description": "Toggle",
111+
"in": [],
112+
"out": []
113+
}
114+
]
115+
},
116+
{
117+
"iid": 4,
118+
"type": "urn:miot-spec-v2:service:air-conditioner:0000780F:tofan-wk01:1",
119+
"description": "Air Conditioner",
120+
"properties": [
121+
{
122+
"iid": 1,
123+
"type": "urn:miot-spec-v2:property:on:00000006:tofan-wk01:1",
124+
"description": "Switch Status",
125+
"format": "bool",
126+
"access": [
127+
"read",
128+
"write",
129+
"notify"
130+
]
131+
},
132+
{
133+
"iid": 2,
134+
"type": "urn:miot-spec-v2:property:target-temperature:00000021:tofan-wk01:1",
135+
"description": "Target Temperature",
136+
"format": "uint8",
137+
"access": [
138+
"read",
139+
"write",
140+
"notify"
141+
],
142+
"unit": "celsius",
143+
"value-range": [
144+
16,
145+
32,
146+
1
147+
]
148+
},
149+
{
150+
"iid": 3,
151+
"type": "urn:miot-spec-v2:property:fan-level:00000016:tofan-wk01:1",
152+
"description": "Fan Level",
153+
"format": "uint8",
154+
"access": [
155+
"read",
156+
"write",
157+
"notify"
158+
],
159+
"value-list": [
160+
{
161+
"value": 0,
162+
"description": "Auto"
163+
},
164+
{
165+
"value": 2,
166+
"description": "Low"
167+
},
168+
{
169+
"value": 3,
170+
"description": "Medium"
171+
},
172+
{
173+
"value": 4,
174+
"description": "High"
175+
}
176+
]
177+
}
178+
]
179+
}
180+
],
22181
"urn:miot-spec-v2:device:water-heater:0000A02A:xiaomi-yms2:1": [
23182
{
24183
"iid": 2,

custom_components/xiaomi_home/miot/specs/spec_filter.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ urn:miot-spec-v2:device:motion-sensor:0000A014:xiaomi-pir1:
4444
urn:miot-spec-v2:device:router:0000A036:xiaomi-rd03:
4545
services:
4646
- '*'
47+
urn:miot-spec-v2:device:thermostat:0000A031:tofan-wk01:
48+
services:
49+
- '2'
50+
- '4'

0 commit comments

Comments
 (0)