How to repeat an action until another (specific) device trigger is received in home assistant
How to repeat an action until another (specific) device trigger is received in home assistant
To repeat an action in Home Assistant until a specific device trigger is received, use a repeat-until loop combined with a wait_for_trigger action.
until


alias: New automation find my mobile phone - 找手机
description: >-
- http://localhost:4999/boards/topic/16760/notify - ##
http://localhost:4999/boards/topic/16760 - ##
http://192.168.2.125:8123/config/automation/edit/1747045045725
triggers:
- trigger: conversation
command: "[找手机|手机|手机在哪儿|我手机在哪儿]"
id: id_find_my_phone
- trigger: state
entity_id:
- binary_sensor.sm_g9910_private_interactive
from:
- "off"
to:
- "on"
id: id_phone_interactive_turn_on
enabled: true
conditions: []
actions:
- repeat:
until:
- condition: trigger
id:
- id_phone_interactive_turn_on
sequence:
- action: script.turn_on
metadata: {}
data: {}
target:
entity_id: script.find_my_phone
- delay:
hours: 0
minutes: 0
seconds: 5
milliseconds: 0
enabled: false
mode: single
way 2.
sequence:
- variables:
stopVar: false
- parallel:
- repeat:
until:
- condition: template
value_template: "{{ stopVar == true }}"
sequence:
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- action: input_boolean.toggle
metadata: {}
data: {}
target:
entity_id: input_boolean.quick_toggle
- sequence:
- wait_for_trigger:
- trigger: state
entity_id:
- button.push
- variables:
stopVar: true
alias: Parallel Test
description: ""
Comments
Be the first to post a comment