Loop Alarm Siren Automation

hi

I have the following Automation that kicks of the the alarm siren through a ring tone on my Xiaomi Hub. however it only lasts for 30 seconds, how can I make this loop until the alarm is disarmed ?

- alias: 'Alarm Triggered Siren'
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: alarm_control_panel.house
    to: 'triggered'
  action:
    service: xiaomi_aqara.play_ringtone
    data:
      gw_mac: (mac removed for this post)
      ringtone_id: 0
      ringtone_vol: 100

Thanks in advance

I would like to know this too.
I just recieved Xiaomi gateway kit (5in1, motion, temp, window/door sensor), and started to implement it in my configuration.
So far I have managed to automate lights with xiaomi sensors, automate night light, etc.
What I can’t figure out is how to ARM/DISARM alarm from home assistant?
I would love to automate alarm arming/disarming using presence (device tracker).
Here is the link I found about alarm loop, hope you can find it usefull.

you may want to check this out:

xiaomi_alarm:
alias: xiaomi_alarm
sequence:
  - service: xiaomi_aqara.play_ringtone
    data_template:
       ringtone_id: 0
       ringtone_vol: 90
       gw_mac: !secret xiaomi_sid
  - service: xiaomi_aqara.play_ringtone
    data_template:
       ringtone_id: 0
       ringtone_vol: 90
       gw_mac: !secret xiaomi_sid2
  - service: script.xiaomi_alarm_loop  
xiaomi_alarm_loop:
alias: xiaomi_alarm
sequence:
  - delay:
      seconds: 14
  - service: script.turn_off
    entity_id: script.xiaomi_alarm
  - service_template: >
     {%- if is_state("alarm_control_panel.ha_alarm","triggered") -%} script.xiaomi_alarm
     {%- else %} script.xiaomi_stop
     {% endif %}
1 Like

cool thanks, i learnt how to do basic scripting last night … could be my new best firend in HA…

Next step to try and learn python :slight_smile: