2010 字
10 分钟
凯度蒸烤箱接入HomeAssistant【二】
NOTE通过 tuya local 本地控制凯度蒸烤箱
方案
目前已经有了烤箱的host、deviceId、localkey等参数,研究发现 tuya local 可以添加设备的配置文件来控制设备。
- 项目的配置文件目录:custom_components/tuya_local/devices
- 配置文件编写说明: README
tuya的设备DPS信息可以从 tuya iot官网获得,需要注册账号,关联tuya app,最后调用接口获取设备描述信息。
设备描述信息
{
"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"
}
和
{
"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": ""
}
}
]
}
]
}
可控制方法
{
"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
文件内容
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: 高湿蒸烤
效果图
目前已经在 tuya_local 仓库提交PR,合并后就不需要自己再配置插件。
IMPORTANT当前已经合并到 tuya_local ,直接安装插件即可。
相关文档
- tuya_local: https://github.com/make-all/tuya-local
- 涂鸦设备用localtuya接入HA,DP具体含义和取值范围的获取: https://bbs.hassbian.com/thread-18489-1-1.html
凯度蒸烤箱接入HomeAssistant【二】
https://www.jianyun.run/posts/casdon-join-homeassistant2/