make-all / tuya-local

Local support for Tuya devices in Home Assistant
MIT License
1.34k stars 520 forks source link

Request support for OPK K2 Vacuum #1821

Closed simplelnx closed 5 months ago

simplelnx commented 6 months ago

Request to add OPK K2 Vacuum

Log Message

{"updated_at": 1712935560.2495656, "1": true, "2": false, "3": "standby", "5": "charge_done", "6": 100, "13": true, "15": "202404112221046", "16": 0, "17": 0, "18": 0, "101": "nar", "102": 37, "103": 173, "105": "tskErr0015", "106": "AdapterVol:19546", "107": "Robot Mode:RANDOM", "108": "BatVol:12805"}

Information about DPS mappings

1 power 2 switch_go 3 mode Range "standby","smart","random","chargego","right_bow","wall_follow","spiral" 4 direction_control Range "forward","backward","turn_left","turn_right","stop" 5 status 6 battery_percentage 16 clean_area 17 clean_time 18 fault_code 101 water_sction "low","nar","high"

Product ID

6k8pca2ywenbry2l

Information about how the device functions

Created yaml file using template from lefant_ls1_vacuum.yaml

This is tested and validated on a OKP Vacuum. Please add it to list of devices if you feel useful.

name: OKP vacuum products:

simplelnx commented 6 months ago

Below are the full dp's list from tuya. These are covered in config above. So only for reference.

{\"abilityId\":1,\"accessMode\":\"rw\",\"code\":\"power\",\"description\":\"【非必选】\\n\\\"可选择无开关机功能。\\n开关机控制。\\n下发: 发送控制指令给主机,主机依据指令状态进行开关机操作。\\n上报:\\n当主机使用遥控器关机或者长时间静止进入关机状态后,主机会上报一个关机数据。\\n当主机处于关机状态时,通过遥控器或者触摸主机的按键,主机会进入开机状态,主机会上报一个开机数据。\\\"\\n\",\"extensions\":{\"iconName\":\"icon-dp_power2\"},\"name\":\"开关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":2,\"accessMode\":\"rw\",\"code\":\"switch_go\",\"description\":\"【必选】\",\"extensions\":{\"iconName\":\"icon-dp_power\",\"attribute\":\"544\"},\"name\":\"清扫开关\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":3,\"accessMode\":\"rw\",\"code\":\"mode\",\"description\":\"【必选】枚举值按需选择,不需要的可删除\\nstandby:待机模式,random:随机模式,smart:自动清扫, wall_follow:沿边清扫 ,mop:拖地功能 , spiral:定点清扫,left_spiral:左螺旋,right_spiral:右螺旋,right_bow:右⼸弓字,left_bow:左⼸弓字,partial_bow:局部弓字, chargego:回充模式\\n\",\"extensions\":{\"iconName\":\"icon-dp_mode\"},\"name\":\"工作模式\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"standby\",\"smart\",\"chargego\",\"right_bow\",\"wall_follow\",\"spiral\"]}},
{\"abilityId\":4,\"accessMode\":\"rw\",\"code\":\"direction_control\",\"description\":\"【必选】\\n默认逻辑:按住方向键下发 前/后/左转/右转,手指抬起下发停止\\\"\\n前进:forward\\n后退:backward\\n左转:turn_left\\n右转:turn_right\\n停止:stop\\n\\n\",\"extensions\":{\"iconName\":\"icon-dp_wind\"},\"name\":\"方向\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"forward\",\"backward\",\"turn_left\",\"turn_right\",\"stop\"]}},
{\"abilityId\":5,\"accessMode\":\"ro\",\"code\":\"status\",\"description\":\"【必选】默认枚举值不可删除,否则影响控制面板逻辑,可以调整排列顺序,但是单词必须一模一样,不可修改单词,例如不能把smart修改为AOTU,保证默认的不变,可在后面增加其他状态值,状态值尽量是状态的英文小写单词,如需要增加故障中状态,则为in_trouble。\\nstandby 待机中\\nsmart_clean 自动清扫中\\nwall_clean 沿墙清扫中\\nspot_clean 定点清扫中\\nmop_clean 拖地清扫中\\ngoto_charge 回座中\\ncharging 充电中\\ncharge_done 充电完成\\npaused 暂停\\ncleaning 清扫中\\nsleep 休眠\\n\",\"extensions\":{\"iconName\":\"icon-dp_dust\",\"attribute\":\"1602\"},\"name\":\"工作状态\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"standby\",\"smart_clean\",\"wall_clean\",\"spot_clean\",\"goto_charge\",\"charging\",\"cleaning\",\"charge_done\",\"paused\"]}},
{\"abilityId\":6,\"accessMode\":\"ro\",\"code\":\"battery_percentage\",\"description\":\"【非必选】默认区间为0%—100%(没有小数点),如果需要显示为小数点,可以修改倍数参数,例如需要支持一位小数点,则倍数参数为1,上报的数值会经过计算,保留一位小数,例如上报589,经过换算后为58.9%。\",\"extensions\":{\"attribute\":\"1090\"},\"name\":\"剩余电量\",\"typeSpec\":{\"type\":\"value\",\"max\":100,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"%\"}},
{\"abilityId\":13,\"accessMode\":\"rw\",\"code\":\"seek\",\"description\":\"【非必选】\\n\",\"extensions\":{\"iconName\":\"icon-dp_curve\"},\"name\":\"寻找机器\",\"typeSpec\":{\"type\":\"bool\"}},
{\"abilityId\":15,\"accessMode\":\"ro\",\"code\":\"clean_record\",\"description\":\"\\n清扫日期+ YYYYMMDDTTRR 清扫时长 + XXX 清扫面积 xxx 如: \\\"201804110511020080\\\" 代表2018年4月11日05点11分,清扫了20分钟,80平方米 (假如MCU没有RTC,时间可不上报。记录则默认显示为数据上报时间)\",\"extensions\":{\"iconName\":\"icon-dp_direction\"},\"name\":\"清扫记录\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},
{\"abilityId\":16,\"accessMode\":\"ro\",\"code\":\"clean_area\",\"description\":\"【非必选】默认区间为0min—9999㎡(没有小数点),如果需要显示为小数点,可以修改倍数参数,例如需要支持一位小数点,则倍数参数为1,上报的数值会经过计算,保留一位小数,例如上报589,经过换算后为58.9㎡。\",\"extensions\":{\"iconName\":\"icon-dp_voice\",\"attribute\":\"64\"},\"name\":\"清扫面积\",\"typeSpec\":{\"type\":\"value\",\"max\":9999,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"㎡\"}},
{\"abilityId\":17,\"accessMode\":\"ro\",\"code\":\"clean_time\",\"description\":\"【非必选】 MCU上报本次清扫时间,实时更新\",\"extensions\":{\"iconName\":\"icon-dp_warming\",\"attribute\":\"64\"},\"name\":\"清扫时间\",\"typeSpec\":{\"type\":\"value\",\"max\":9999,\"min\":0,\"scale\":0,\"step\":1,\"unit\":\"min\"}},
{\"abilityId\":18,\"accessMode\":\"ro\",\"code\":\"fault\",\"description\":\"\\n\",\"extensions\":{\"iconName\":\"icon-dp_time2\",\"scope\":\"fault\"},\"name\":\"故障告警\",\"typeSpec\":{\"type\":\"bitmap\",\"label\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\"],\"maxlen\":23}},
{\"abilityId\":19,\"accessMode\":\"ro\",\"code\":\"map_config\",\"description\":\"【有地图则必选】如果扫地机有地图功能,需要选择此功能点,用于配置地图参数,具体格式如下: 共3个字节,第一个字节为原点(0,0)位置,二三字节为地图最大的长宽 0x00 左上角 0x01 左下角 例:0x0000ff 左上角,最大长宽值为255\",\"extensions\":{\"iconName\":\"icon-dp_time\",\"attribute\":\"96\"},\"name\":\"地图参数\",\"typeSpec\":{\"type\":\"raw\",\"maxlen\":128}},
{\"abilityId\":101,\"accessMode\":\"rw\",\"code\":\"water_sction\",\"description\":\"\",\"extensions\":{\"iconName\":\"icon-jiare1\"},\"name\":\"风量\\\\水量显示\",\"typeSpec\":{\"type\":\"enum\",\"range\":[\"low\",\"nar\",\"high\"]}},
{\"abilityId\":102,\"accessMode\":\"ro\",\"code\":\"temp_unseen\",\"description\":\"\",\"name\":\"机箱温度\",\"typeSpec\":{\"type\":\"value\",\"max\":30000,\"min\":-30000,\"scale\":0,\"step\":1,\"unit\":\"℃\"}},
{\"abilityId\":103,\"accessMode\":\"ro\",\"code\":\"Yaw_unseen\",\"description\":\"\",\"name\":\"航向角\",\"typeSpec\":{\"type\":\"value\",\"max\":30000,\"min\":-30000,\"scale\":0,\"step\":1,\"unit\":\"\"}},
{\"abilityId\":105,\"accessMode\":\"ro\",\"code\":\"WheelState_unseen\",\"description\":\"\",\"name\":\"轮子状态\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},
{\"abilityId\":106,\"accessMode\":\"ro\",\"code\":\"ChargeState_unseen\",\"description\":\"\",\"name\":\"充电状态\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},
{\"abilityId\":107,\"accessMode\":\"ro\",\"code\":\"ModeState_unseen\",\"description\":\"\",\"name\":\"模式状态\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}},
{\"abilityId\":108,\"accessMode\":\"ro\",\"code\":\"RobotLog_unseen\",\"description\":\"\",\"name\":\"RobotLog\",\"typeSpec\":{\"type\":\"string\",\"maxlen\":255}}]}]}"

}