Featured image of post 凯度蒸烤箱接入HomeAssistant【二】

凯度蒸烤箱接入HomeAssistant【二】

通过 tuya local 本地控制凯度蒸烤箱

方案

目前已经有了烤箱的host、deviceId、localkey等参数,研究发现 tuya local 可以添加设备的配置文件来控制设备。

tuya的设备DPS信息可以从 tuya iot官网获得,需要注册账号,关联tuya app,最后调用接口获取设备描述信息。

设备描述信息

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
  "result": {
    "category": "kx",
    "functions": [
      {
        "code": "switch",
        "desc": "{}",
        "name": "开关",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "start",
        "desc": "{}",
        "name": "启动/停止",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "cook_temperature",
        "desc": "{\"unit\":\"℃\",\"min\":0,\"max\":500,\"scale\":0,\"step\":1}",
        "name": "烹饪温度",
        "type": "Integer",
        "values": "{\"unit\":\"℃\",\"min\":0,\"max\":500,\"scale\":0,\"step\":1}"
      },
      {
        "code": "appointment_time",
        "desc": "{\"unit\":\"min\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}",
        "name": "预约时间",
        "type": "Integer",
        "values": "{\"unit\":\"min\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}"
      },
      {
        "code": "cook_time",
        "desc": "{\"unit\":\"min\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}",
        "name": "烹饪时间",
        "type": "Integer",
        "values": "{\"unit\":\"min\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}"
      }
    ],
    "status": [
      {
        "code": "switch",
        "name": "开关",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "start",
        "name": "启动/停止",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "cook_temperature",
        "name": "烹饪温度",
        "type": "Integer",
        "values": "{\"unit\":\"℃\",\"min\":0,\"max\":500,\"scale\":0,\"step\":1}"
      },
      {
        "code": "temp_current",
        "name": "当前温度",
        "type": "Integer",
        "values": "{\"unit\":\"℃\",\"min\":0,\"max\":500,\"scale\":0,\"step\":1}"
      },
      {
        "code": "appointment_time",
        "name": "预约时间",
        "type": "Integer",
        "values": "{\"unit\":\"min\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}"
      },
      {
        "code": "cook_time",
        "name": "烹饪时间",
        "type": "Integer",
        "values": "{\"unit\":\"min\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}"
      },
      {
        "code": "remain_time",
        "name": "剩余时间",
        "type": "Integer",
        "values": "{\"unit\":\"\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}"
      }
    ]
  },
  "success": true,
  "t": 1720485984266,
  "tid": "xxxxx"
}

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
{
  "modelId": "000004nuey",
  "services": [
    {
      "actions": [],
      "code": "",
      "description": "",
      "events": [],
      "name": "默认服务",
      "properties": [
        {
          "abilityId": 1,
          "accessMode": "rw",
          "code": "switch",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_power2",
            "attribute": "5"
          },
          "name": "开关",
          "typeSpec": {
            "type": "bool"
          }
        },
        {
          "abilityId": 2,
          "accessMode": "rw",
          "code": "start",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_play"
          },
          "name": "启动/暂停",
          "typeSpec": {
            "type": "bool"
          }
        },
        {
          "abilityId": 7,
          "accessMode": "rw",
          "code": "cook_temperature",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_temp"
          },
          "name": "烹饪温度",
          "typeSpec": {
            "type": "value",
            "max": 500,
            "min": 0,
            "scale": 0,
            "step": 1,
            "unit": "℃"
          }
        },
        {
          "abilityId": 8,
          "accessMode": "ro",
          "code": "temp_current",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_c"
          },
          "name": "当前温度",
          "typeSpec": {
            "type": "value",
            "max": 500,
            "min": 0,
            "scale": 0,
            "step": 1,
            "unit": "℃"
          }
        },
        {
          "abilityId": 9,
          "accessMode": "rw",
          "code": "appointment_time",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_time3"
          },
          "name": "预约时间",
          "typeSpec": {
            "type": "value",
            "max": 1440,
            "min": 0,
            "scale": 0,
            "step": 1,
            "unit": "min"
          }
        },
        {
          "abilityId": 10,
          "accessMode": "rw",
          "code": "cook_time",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_time3"
          },
          "name": "烹饪时间",
          "typeSpec": {
            "type": "value",
            "max": 1440,
            "min": 0,
            "scale": 0,
            "step": 1,
            "unit": "min"
          }
        },
        {
          "abilityId": 11,
          "accessMode": "ro",
          "code": "remain_time",
          "description": "",
          "extensions": {
            "iconName": "icon-dp_time2"
          },
          "name": "工作剩余时间",
          "typeSpec": {
            "type": "value",
            "max": 1440,
            "min": 0,
            "scale": 0,
            "step": 1,
            "unit": ""
          }
        },
        {
          "abilityId": 13,
          "accessMode": "ro",
          "code": "fault",
          "description": "er1:腔体高温保护(腔体传感器温度高于290°C);\ner2:蒸发盘高温保护(蒸发盘传感器温度高于200°C);\ner3:腔体低温保护(连续工作5分钟温度低于35°C);\ner4:蒸发盘低温保护(连续工作5分钟温度低于35°C);\ner5:传感器连接出故障(腔体或蒸发盘传感器开路);\ner6:传感器感应出故障(腔体或蒸发盘传感器短路);\ner7:显示板通信故障;\ner8:水箱开关(CN7)未闭合或者蒸发盘NTC(CN3)温度高于125℃并持续时间达25s后,缺水提示,并停止工作。",
          "extensions": {
            "iconName": "icon-baojing",
            "scope": "fault"
          },
          "name": "故障告警",
          "typeSpec": {
            "type": "bitmap",
            "label": [
              "er1",
              "er2",
              "er3",
              "er4",
              "er5",
              "er6",
              "er7",
              "er8"
            ],
            "maxlen": 8
          }
        },
        {
          "abilityId": 101,
          "accessMode": "rw",
          "code": "rag_lock",
          "description": "",
          "extensions": {
            "iconName": "icon-gongneng",
            "attribute": "4096"
          },
          "name": "童锁功能",
          "typeSpec": {
            "type": "bool"
          }
        },
        {
          "abilityId": 102,
          "accessMode": "rw",
          "code": "cook_status",
          "description": "reservation预约中 cooking烹饪中 cancel烹饪取消 wait烹饪等待 done烹饪完成 pause烹饪暂停",
          "name": "烹饪状态",
          "typeSpec": {
            "type": "enum",
            "range": [
              "wait",
              "reservation",
              "cooking",
              "cancel",
              "done",
              "pause"
            ]
          }
        },
        {
          "abilityId": 103,
          "accessMode": "rw",
          "code": "lamp",
          "description": "",
          "name": "炉灯",
          "typeSpec": {
            "type": "bool"
          }
        },
        {
          "abilityId": 104,
          "accessMode": "ro",
          "code": "cook_start_time",
          "description": "",
          "name": "预约烹饪开始时间",
          "typeSpec": {
            "type": "value",
            "max": 1440,
            "min": 0,
            "scale": 0,
            "step": 1,
            "unit": ""
          }
        },
        {
          "abilityId": 105,
          "accessMode": "rw",
          "code": "all_mode",
          "description": "1.健康蒸, 2.鲜嫩蒸, 3.高温蒸, 4.养生炖, 5.上下烤, 6.立体烧烤, 7.底部热风, 8.上强烤, 9.3D热风,10.空气炸, 11.蒸汽炸, 12.一键面包 13.速热 14.保温 15.解冻 16.发酵 17.除垢 18.菜谱模式 19.内腔烘干 ,20.自定义模式,21.低湿蒸烤,22.中湿蒸烤,23.高湿蒸烤",
          "name": "模式选择",
          "typeSpec": {
            "type": "enum",
            "range": [
              "1",
              "2",
              "3",
              "4",
              "5",
              "6",
              "7",
              "8",
              "9",
              "10",
              "11",
              "12",
              "13",
              "14",
              "15",
              "16",
              "17",
              "18",
              "19",
              "20",
              "21",
              "22",
              "23"
            ]
          }
        },
        {
          "abilityId": 106,
          "accessMode": "rw",
          "code": "recipe_mode",
          "description": "1-50 文档中的菜谱",
          "name": "菜谱模式",
          "typeSpec": {
            "type": "value",
            "max": 50,
            "min": 1,
            "scale": 0,
            "step": 1,
            "unit": ""
          }
        },
        {
          "abilityId": 107,
          "accessMode": "rw",
          "code": "diy_mode",
          "description": "协议见文档",
          "name": "DIY菜谱",
          "typeSpec": {
            "type": "raw",
            "maxlen": 128
          }
        },
        {
          "abilityId": 108,
          "accessMode": "rw",
          "code": "up_temp",
          "description": "单独的上温度",
          "name": "上温度",
          "typeSpec": {
            "type": "value",
            "max": 500,
            "min": 0,
            "scale": 0,
            "step": 1,
            "unit": ""
          }
        },
        {
          "abilityId": 109,
          "accessMode": "rw",
          "code": "down_temp",
          "description": "单独的下温度",
          "name": "下温度",
          "typeSpec": {
            "type": "value",
            "max": 500,
            "min": 0,
            "scale": 0,
            "step": 1,
            "unit": ""
          }
        }
      ]
    }
  ]
}

可控制方法

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
  "result": {
    "category": "kx",
    "functions": [
      {
        "code": "switch",
        "desc": "switch",
        "name": "switch",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "start",
        "desc": "start",
        "name": "start",
        "type": "Boolean",
        "values": "{}"
      },
      {
        "code": "cook_temperature",
        "desc": "cook temperature",
        "name": "cook temperature",
        "type": "Integer",
        "values": "{\"unit\":\"℃\",\"min\":0,\"max\":500,\"scale\":0,\"step\":1}"
      },
      {
        "code": "appointment_time",
        "desc": "appointment time",
        "name": "appointment time",
        "type": "Integer",
        "values": "{\"unit\":\"min\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}"
      },
      {
        "code": "cook_time",
        "desc": "cook time",
        "name": "cook time",
        "type": "Integer",
        "values": "{\"unit\":\"min\",\"min\":0,\"max\":1440,\"scale\":0,\"step\":1}"
      }
    ]
  },
  "success": true,
  "t": 1720486581288,
  "tid": "xxxxx"
}

配置文件

参考 DPS信息 和 tuya local 配置,编写了凯度蒸烤箱的配置文件 custom_components/tuya_local/devices/casdon_td_pro_2.yaml

文件内容

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Casdon TD Pro 2
products:
  - id: wab6oustdukujpkn
    name: 蒸烤箱TD-pro二代
primary_entity:
  entity: switch
  icon: "mdi:power"
  name: Switch
  dps:
    - id: 1
      type: boolean
      name: switch

secondary_entities:
  - entity: switch
    name: Start
    icon: "mdi:play-pause"
    dps:
      - id: 2
        name: switch
        type: boolean
  - entity: number
    name: cook_temperature
    dps:
      - id: 7
        name: value
        type: integer
        unit: C
        range:
          min: 0
          max: 500
  - entity: sensor
    name: temp_current
    class: temperature
    dps:
      - id: 8
        name: sensor
        type: integer
        unit: C
        readonly: true
        range:
          min: 0
          max: 500
  - entity: number
    name: appointment_time
    dps:
      - id: 9
        name: value
        type: integer
        optional: true
        range:
          min: 0
          max: 1440
        unit: min
        class: measurement
  - entity: number
    icon: "mdi:timer-edit"
    name: cook_time
    dps:
      - id: 10
        name: value
        type: integer
        range:
          min: 0
          max: 1440
        unit: min
        class: measurement
  - entity: sensor
    icon: "mdi:timer"
    name: remain_time
    dps:
      - id: 11
        name: sensor
        type: integer
        readonly: true
        range:
          min: 0
          max: 1440
        unit: min
        class: measurement
  - entity: sensor
    name: fault_message
    category: diagnostic
    dps:
      - id: 13
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: OK
          - dps_val: 1
            value: "er1:腔体高温保护(腔体传感器温度高于290°C)"
          - dps_val: 2
            value: "er2:蒸发盘高温保护(蒸发盘传感器温度高于200°C)"
          - dps_val: 4
            value: "er3:腔体低温保护(连续工作5分钟温度低于35°C)"
          - dps_val: 8
            value: "er4:蒸发盘低温保护(连续工作5分钟温度低于35°C)"
          - dps_val: 16
            value: "er5:传感器连接出故障(腔体或蒸发盘传感器开路)"
          - dps_val: 32
            value: "er6:传感器感应出故障(腔体或蒸发盘传感器短路)"
          - dps_val: 64
            value: "er7:显示板通信故障"
          - dps_val: 128
            value: "er8:水箱开关(CN7)未闭合或者蒸发盘NTC(CN3)温度高于125℃并持续时间达25s后,缺水提示,并停止工作。"
  - entity: binary_sensor
    name: fault
    category: diagnostic
    dps:
      - id: 13
        type: bitfield
        name: sensor
        mapping:
          - dps_val: 0
            value: false
          - value: true
  - entity: sensor
    name: cook_status
    class: enum
    dps:
      - id: 102
        name: sensor
        type: string
        readonly: true
        mapping:
          - dps_val: wait
            value: 烹饪等待
          - dps_val: reservation
            icon: "mdi:cup-water"
            value: 预约中
          - dps_val: cooking
            icon: "mdi:cup"
            value: 烹饪中
          - dps_val: cancel
            icon: "mdi:cup"
            value: 烹饪取消
          - dps_val: done
            icon: "mdi:cup"
            value: 烹饪完成
          - dps_val: pause
            icon: "mdi:cup"
            value: 烹饪暂停
  - entity: switch
    name: Lamp
    icon: "mdi:lightbulb-on"
    dps:
      - id: 103
        name: switch
        type: boolean
  - entity: select
    name: all_mode
    category: config
    dps:
      - id: 105
        name: option
        type: string
        mapping:
          - dps_val: "1"
            value: 健康蒸
          - dps_val: "2"
            value: 鲜嫩蒸
          - dps_val: "3"
            value: 高温蒸
          - dps_val: "4"
            value: 养生炖
          - dps_val: "5"
            value: 上下烤
          - dps_val: "6"
            value: 立体烧烤
          - dps_val: "7"
            value: 底部热风
          - dps_val: "8"
            value: 上强烤
          - dps_val: "9"
            value: 3D热风
          - dps_val: "10"
            value: 空气炸
          - dps_val: "11"
            value: 蒸汽炸
          - dps_val: "12"
            value: 一键面包
          - dps_val: "13"
            value: 速热
          - dps_val: "14"
            value: 保温
          - dps_val: "15"
            value: 解冻
          - dps_val: "16"
            value: 发酵
          - dps_val: "17"
            value: 除垢
          - dps_val: "18"
            value: 菜谱模式
          - dps_val: "19"
            value: 内腔烘干
          - dps_val: "20"
            value: 自定义模式
          - dps_val: "21"
            value: 低湿蒸烤
          - dps_val: "22"
            value: 中湿蒸烤
          - dps_val: "23"
            value: 高湿蒸烤

效果图 0lsL2N 6xEFOX

目前已经在 tuya_local 仓库提交PR,合并后就不需要自己再配置插件。

相关文档

使用 Hugo 构建
主题 StackJimmy 设计