Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 102624

Alarm sound loop. Data template not working

$
0
0

@roelandpollet wrote:

Hi everyone,

Would be really grateful if someone can point me in the right direction, been struggling with the most simple template in my scripts.yaml.
Alarm_sound_loop is called as an action when my alarm control panel is triggered. As long as my alarm is in pending state it needs to loop a beeping sound, once triggered it needs to loop the burglar sound.
The script fully works without the data template, so something must be wrong there. Also cannot seem to get the template for the delay to work, that is now commented.

Anybody any input!


alarm_sound_loop:
  alias: Alarm Triggered Sound Loop
  sequence:
    - condition: or
      conditions:
        - condition: state
          entity_id: alarm_control_panel.security_system
          state: 'triggered'
        - condition: state
          entity_id: alarm_control_panel.security_system
          state: 'pending'
    - service: script.turn_on
      entity_id: script.alarm_sound
alarm_sound:
  alias: Alarm Triggered Sound
  sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.sonos_beam
        volume_level: 0.2
    - service: media_player.play_media
      data_template:
        entity_id: media_player.sonos_beam
        media_content_type: "music"
        media_content_id: >
          {% if is_state('alarm_control_panel.security_system','pending') %}
            !secret pending_beep_url
          {% else %}
            !secret burglar_alarm_sound_url
          {% endif %}
    - delay: "00:00:05" #>
#        {% if is_state('alarm_control_panel.security_system','pending') %}
#          "00:00:01"
#        {% elif is_state('alarm_control_panel.security_system','triggered') %}
#          "00:00:20"
#        {% else %}
#          "00:00:05"
#        {% endif %}
    - service: script.turn_on
      entity_id: script.alarm_sound_loop

Thanks a lot!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 102624

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>