家里的一台石头g10s通过官方集成接入ha。语音助手(官方或者自制),语音助手配置的是chtgpt的中转api(或者其他的llm也可以),由于官方内置助手并没有扫地机器人的指定房间清扫,以及清扫模式(只扫地或者只拖地),所以无法使用。通过llm控制扫地机也不能实现扫地机的指定房间和指定模式清扫,只有简单的开始清扫和返回等,通过这篇帖子https://community.home-assistant ... d-openai-gpt/785052,发现助手不仅可以访问意图,还可以访问 Homeassistant 中可用的脚本。在这里,参数传递工作得很好。只需创建一个脚本并将其公开给 homeassistant同时 给出一个好的描述,以便 gpt 模型知道如何使用它。经过调试,成功实现以下功能:指定房间清扫,指定模式清扫。不需要说的很清楚,比如说拖下客厅,那么扫地机就开始只拖地客厅。
alias: 分区清扫房间选择模式
description: 让扫地机器人清扫指定的房间
fields:
room_name:
description: 要清扫的房间名称
example: 客厅
clean_type:
description: 清扫类型(只扫地、只拖地)
example: 只扫地
sequence:
- variables:
rooms:
走廊: 16
厨房: 17
书房: 18
主卧: 19
客卧: 20
卫生间: 21
阳台: 22
客厅: 23
clean_type: "{{ clean_type | default('只扫地') }}"
- choose:
- conditions:
- condition: template
value_template: "{{ clean_type == '只扫地' }}"
sequence:
- target:
entity_id: vacuum.shi_tou_g10s
data:
command: set_water_box_custom_mode
params:
- 200
action: vacuum.send_command
- conditions:
- condition: template
value_template: "{{ clean_type == '只拖地' }}"
sequence:
- target:
entity_id: vacuum.shi_tou_g10s
data:
command: set_custom_mode
params:
- 105
action: vacuum.send_command
- target:
entity_id: vacuum.shi_tou_g10s
data:
command: set_mop_mode
params:
- 301
action: vacuum.send_command
- target:
entity_id: vacuum.shi_tou_g10s
data:
command: set_water_box_custom_mode
params:
- 203
action: vacuum.send_command
- delay: "00:00:01"
- choose:
- conditions:
- condition: template
value_template: "{{ room_name in rooms }}"
sequence:
- target:
entity_id: vacuum.shi_tou_g10s
data:
command: app_segment_clean
params:
- segments:
- "{{ rooms[room_name] }}"
repeat: 1
action: vacuum.send_command
mode: single
但是目前多房间清扫还没调试好,比如说打扫客厅和主卧。这种还不行,期待论坛的大佬再改进下!
|