Hi thanks for your help much appreciate your time.
I will at some point move audio files to my server I guess they would go into a www folder or something .
Anyway added code below as per your suggestion.
- alias: Security New Automation
description: ''
mode: single
trigger:
- platform: state
entity_id: 'alarm_control_panel.intruder_alarm'
to: 'triggered'
condition: []
action:
- repeat:
until:
- condition: state
entity_id: 'alarm_control_panel.intruder_alarm'
state: 'disarmed'
sequence:
- service: media_player.media_play
data:
entity_id: media_player.family_room_speaker
media_content_id: https://mobcup.net/d/onnookjc/mp3
media_content_type: music
- delay:
seconds: 10
- service: tts.google_say
data:
entity_id: media_player.family_room_speaker
message: 'Warning There Is A Security Breach'
I get error in log when alarm is triggered
2021-07-18 18:47:19 ERROR (MainThread) [homeassistant.components.automation.security_new_automation] Security New Automation: Repeat at step 1: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['media_content_id']
2021-07-18 18:47:19 ERROR (MainThread) [homeassistant.components.automation.security_new_automation] Security New Automation: Error executing script. Invalid data for repeat at pos 1: extra keys not allowed @ data['media_content_id']
2021-07-18 18:47:19 ERROR (MainThread) [homeassistant.components.automation.security_new_automation] Error while executing automation automation.security_new_automation: extra keys not allowed @ data['media_content_id']
Lol just fixed that easy mistake, when run I get no errors in log and google speakers beeps then after some delay says
Warning There Is A Security Breach
Then after some time it started working, playing mp3 link and message but with delays .
I’ll have a bit more of a play with it and maybe I’ll try moving the audio files onto my server hopefully that fixes any delays . But seems like it’s basically there .
Thank you very much
Yes, you should consider storing the .mp3 file locally in /config/www. The reason is because if the website is down and HA cannot retriever the file, it will prevent the automation to continue the repeat function.
After moving it to /config/www, change media_content_id to this- media_content_id: http://HAIP:8123/local/xxx.mp3
wow thank you so so much made my life so much easer and i learnt some stuff too.
it now works perfectly no lag and repeats until disarming system incase some one in future needs it here’s the working code all thanks too ardysusilo
- alias: Security New Automation
description: ''
mode: single
trigger:
- platform: state
entity_id: 'alarm_control_panel.intruder_alarm'
to: 'triggered'
condition: []
action:
- repeat:
until:
- condition: state
entity_id: 'alarm_control_panel.intruder_alarm'
state: 'disarmed'
sequence:
- service: media_player.play_media
data:
entity_id: media_player.family_room_speaker
media_content_id: http://0.0.0.0:8123/local/SecurityAlarm.mp3
media_content_type: music
- delay:
seconds: 10
- service: tts.google_say
data:
entity_id: media_player.family_room_speaker
message: 'Warning There Is A Security Breach'
Given that this automation involves the security of your home, consider making it slightly more robust by eliminating its reliance on repeatedly translating the warning message (each execution of tts.google_say depends on a functional Internet connection).
The Google Translate app allows you to download a spoken phrase. You can store the media file locally and then play it in the same way the automation currently plays SecurityAlarm.mp3.
Cool definitely be doing that I have default paradox programed at a 1 minutes delay so if after that time the big horrible sounders kick in. Thank you for you suggestion much appreciated