我的石头扫地机我设置了两个模式,一个模式比如称为a,另外一个模式比如称为b。我需要做一个自动化,当为离家模式,且离家模式持续20分钟,且家庭成员离家5公里距离上,触发自动化,然后自动化的类型为如果执行过两次a后,那么久执行b,同理,如果之前执行的是b,且执行了一次,那么这次久执行a,请问各位大佬。如何写呢。
a和b为目前用的是小爱触发,如果集合在一起,是否直接用调用里面的激活自动化比较好还是另外再建一个开关。
比如A是以下
alias: 小爱同学打扫阳台(仅扫地)
description: ""
trigger:
- platform: state
entity_id:
- sensor.xiaomi_x10a_c590_conversation
- sensor.xiaomi_l17a_d74c_conversation
to: 打扫阳台
condition: []
action:
- service: vacuum.send_command
data:
command: set_water_box_custom_mode
params:
- 200
target:
entity_id: vacuum.shi_tou_g10s
- service: vacuum.send_command
data:
command: set_custom_mode
params:
- 103
target:
entity_id: vacuum.shi_tou_g10s
- service: vacuum.send_command
data:
command: app_segment_clean
params:
- segments:
- 22
target:
entity_id: vacuum.shi_tou_g10s
mode: single
比如以下是b
alias: 小爱同学打扫阳台(先扫后拖)
description: ""
trigger:
- platform: state
entity_id:
- sensor.xiaomi_x10a_c590_conversation
- sensor.xiaomi_l17a_d74c_conversation
to: 阳台大扫除
condition: []
action:
- service: vacuum.send_command
data:
command: set_water_box_custom_mode
params:
- 200
target:
entity_id: vacuum.shi_tou_g10s
- service: vacuum.send_command
data:
command: set_custom_mode
params:
- 103
target:
entity_id: vacuum.shi_tou_g10s
- service: vacuum.send_command
data:
command: app_segment_clean
params:
- segments:
- 22
target:
entity_id: vacuum.shi_tou_g10s
- wait_for_trigger:
- platform: state
entity_id:
- camera.shi_tou_g10s_map
from: streaming
|