How to repeat a TTS message over Google Home until turned oof

I would like to broadcast a message to my Google Home speakers that will tell me what door/window has been opened when the alarm is armed. This will let me know where an intruder has entered the house. I would like this message to repeat until the alarm is disarmed. My thought is to make a script for each door/window that handles the message delivery then create an automation for each door/window that executes the script for that door/window in the event it is open when the alarm is armed.

My problem is finding a way to repeat the TTS message until I tell it to stop.

My script:

  alias: TTS for Front Door Open
  sequence:
  - data:
      entity_id: media_player.all_speakers
      volume_level: 1
    service: media_player.volume_set
  - delay: '1'
  - data:
      message: Front Door Has Been Opened
    service: notify.walltablet
  - data:
      message: Front Door Has Been Opened
    entity_id: media_player.all_speakers
    service: tts.google_say

Is there a good way to do this?

You could make an input_boolean that gets turned on when the script is started and rechecks the input_boolean every X minutes. If still on it runs the TTS again. You disarm by turning off the input_boolean.

I wonder if there’s a way to use TTS with this?

I think it can be done, using the configuration for notifiers with more parameters:

- platform: group
  name: john_phone_sms
  services:
    - service: twilio_sms
      data:
        target: !secret john_phone
freshwater_temp_alert:
  name: "Warning: I have detected a problem with the freshwater tank temperature"
  entity_id: binary_sensor.freshwater_temperature_status
  state: 'on'
  repeat: 5
  can_acknowledge: true
  skip_first: false
  notifiers:
    - john_phone_sms
1 Like

The alert seems like a good way to do this, but it requires a notify component. I don’t think TTS is a notify component, or am I wrong?

The input_boolean may work, but I feel like it might tax the system. I want this message to repeat every two seconds. If I’m understanding this correctly, I would make an automation that triggers every two seconds and if the condition is met that the input_boolean is on it fires the TTS, correct? If that’s the case, won’t it tax my system and fill my logs to have an automation trigger checked every two seconds?

yes, it might. I thought were talking about a TTS every minute or so, but this sounds more like a sound you want played repeatedly back to back

Every two seconds is very frequent. Will you be able to say the message in two seconds?

Yeah, it would take about 2 seconds to say it. I basically want it to go “FRONT DOOR IS OPEN” - 2 second delay - “FRONT DOOR IS OPEN” - 2 second delay - “FRONT DOOR IS OPEN”… repeat.

Wow… That would piss my wife off to no end and she would kill me. I understand the importance of urgency, but that might be a little overboard. LOL

It wont do it whenever the door is open, it only runs when the alarm triggers. It supplements the siren to tell me where the potential intruder broke in at. It wont do any good to have it tell me every 30 seconds. It’s info I would need to know immediately if there was an intruder in my house. It could also help scare off an intruder if they know that I know where they are.

easier with node red

I haven’t used node red, but that seems like it wouldn’t work for my application. It looks like the loop would stop once the door is closed. If someone broke in then closed the door the TTS would stop.

can you share as json? thanks

[{“id”:“ab327849.b4f5d8”,“type”:“server-state-changed”,“z”:“c631c70f.d4b328”,“name”:“Back Door Open”,“server”:“94ba947a.815568”,“entityidfilter”:“binary_sensor.back_door”,“entityidfiltertype”:“substring”,“haltifstate”:“off”,“outputinitially”:false,“x”:100,“y”:560,“wires”:[[“f5f272b.8637f9”]]},{“id”:“b8bb5e95.5c0b9”,“type”:“api-current-state”,“z”:“c631c70f.d4b328”,“name”:“Still Open”,“server”:“94ba947a.815568”,“halt_if”:“off”,“override_topic”:false,“override_payload”:false,“override_data”:false,“entity_id”:“binary_sensor.back_door”,“x”:540,“y”:560,“wires”:[[“6ab5b059.bbd59”,“2acafbaf.f12574”,“8140c08.2bd804”,“878b71c2.f16a9”,“b37eb51f.c7f728”]]},{“id”:“f5f272b.8637f9”,“type”:“stoptimer”,“z”:“c631c70f.d4b328”,“duration”:“1”,“units”:“Minute”,“payloadtype”:“str”,“payloadval”:“off”,“name”:"",“x”:320,“y”:560,“wires”:[[“b8bb5e95.5c0b9”],[]]},{“id”:“6ab5b059.bbd59”,“type”:“api-call-service”,“z”:“c631c70f.d4b328”,“name”:“echo_show”,“server”:“94ba947a.815568”,“service_domain”:“media_player”,“service”:“alexa_tts”,“data”:"{ “entity_id”: “media_player.echo_show”, “message”: “Can someone please close the back door?” }",“mergecontext”:"",“x”:850,“y”:540,“wires”:[[]]},{“id”:“8140c08.2bd804”,“type”:“api-call-service”,“z”:“c631c70f.d4b328”,“name”:“echo_son”,“server”:“94ba947a.815568”,“service_domain”:“media_player”,“service”:“alexa_tts”,“data”:"{ “entity_id”: “media_player.echo_son”, “message”: “Can someone please close the back door?” }",“mergecontext”:"",“x”:840,“y”:600,“wires”:[[]]},{“id”:“878b71c2.f16a9”,“type”:“api-call-service”,“z”:“c631c70f.d4b328”,“name”:“echo_dad”,“server”:“94ba947a.815568”,“service_domain”:“media_player”,“service”:“alexa_tts”,“data”:"{ “entity_id”: “media_player.echo_dad”, “message”: “Can someone please close the back door?” }",“mergecontext”:"",“x”:840,“y”:660,“wires”:[[]]},{“id”:“2acafbaf.f12574”,“type”:“delay”,“z”:“c631c70f.d4b328”,“name”:"",“pauseType”:“delay”,“timeout”:“15”,“timeoutUnits”:“seconds”,“rate”:“1”,“nbRateUnits”:“1”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:false,“x”:540,“y”:660,“wires”:[[“b8bb5e95.5c0b9”]]},{“id”:“1e7f55f7.69496a”,“type”:“api-call-service”,“z”:“c631c70f.d4b328”,“name”:“Send to Android”,“server”:“94ba947a.815568”,“service_domain”:“notify”,“service”:“android”,“data”:"{ “message”: “Basement window is still open after 5 minutes” }",“mergecontext”:"",“x”:860,“y”:480,“wires”:[[]]},{“id”:“b37eb51f.c7f728”,“type”:“delay”,“z”:“c631c70f.d4b328”,“name”:"",“pauseType”:“delay”,“timeout”:“5”,“timeoutUnits”:“minutes”,“rate”:“1”,“nbRateUnits”:“1”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:false,“x”:540,“y”:480,“wires”:[[“b8bb5e95.5c0b9”,“1e7f55f7.69496a”]]},{“id”:“94ba947a.815568”,“type”:“server”,“z”:"",“name”:“Home Assistant”,“legacy”:false,“hassio”:true,“rejectUnauthorizedCerts”:true}]

I stop it when the door is closed but you can change to keep it talking or sending text to your phone by remove “off” at Halt If.

image

8am-5pm when you’re at work, 5pm-8am when you’re at home which you don’t want to get annoy by it.

The loop timer will trigger when it is true and keep loops until it max out, even though the door is closed.
Loop%20time

thank you soo much.

Thanks, cyberumb15! Sounds like a good excuse to learn node red. I’d like to stop the loop when the alarm is disarmed. Is there a way to do that? It would definitely annoy the wife if we disarmed the alarm but the loop kept going for 100 loops.

You can create another input_boolean on/off, place it after the looptimer, the input_boolean will be set it on whenever the door is open, you can turn it off whenever you want to stop it looping.

There are a lot smart people know more scripts and command to combine with this node-red to make better and shorter than mine, please don’t hesitate to chime in

I tried playing with Node Red but got overwhelmed, but I did find a way to do this. I created a 2 second timer, used that as an automation trigger that sends the TTS message, then I restart the timer after the message plays. I plan to add a condition to this that the alarm has to be in “triggered” state for it to run. I haven’t tested this yet, but my assumption is that disarming the alarm will stop the cycle because the condition wouldn’t be met. Now, I just need to add an automation with an action that triggers this repeating automation only if a door is open when the alarm is armed.

Automation:

- id: '1543371050424'
  alias: TTS Repeat - Front Door Open
  trigger:
  - event_data:
      entity_id: timer.repeattimer
    event_type: timer.finished
    platform: event
  condition: []
  action:
  - alias: ''
    data:
      entity_id: script.1543202013064
    service: script.turn_on
  - data:
      entity_id: timer.repeattimer
    service: timer.start

Script:

'1543202013064':
  alias: TTS for Front Door Open
  sequence:
  - data:
      message: Front Door Has Been Opened
    service: notify.walltablet
  - data:
      message: Front Door Has Been Opened
    entity_id: media_player.all_speakers
    service: tts.google_say