Door open TTS announcer

My kids always leave the garden door open, even when its freezing outside, so I made a google Text-To-Speech (TTS) announcer that won’t stop until the door is closed. It’s my first blueprint and based on some other motion sensor examples I’ve seen on this forum.

Enjoy!

blueprint:
  name: Door open TTS announcer
  domain: automation
  input:
    door_entity:
      name: Door Sensor
      description: Entity that causes announcement
      selector:
        entity:
          domain: binary_sensor
          device_class: door
    speaker_target:
      name: Speaker
      description: Entity to announce event on
      selector:
        target:
          entity:
            domain: media_player
    announcement_message:
      name: Announcement message
      description: What to say when door is opened
    final_message:
      name: Final message
      description: What to say when door is closed  
    cooldown:
      name: Announcement cooldown
      description: The minimum time needed in between announcements
      default: 10
      selector:
        number:
          min: 0
          max: 600
          unit_of_measurement: seconds

mode: single

trigger:
  platform: state
  entity_id: !input door_entity
  from: "off"
  to: "on"

action:
  - alias: Repeat the sequence UNTIL the door is closed
    repeat:
      sequence:
        - delay: !input cooldown 
        - service: tts.google_translate_say
          target: !input speaker_target
          data:
            message: !input announcement_message
      until:
        - condition: state
          entity_id: !input door_entity
          state: 'off'
  - service: tts.google_translate_say
    target: !input speaker_target
    data:
      message: !input final_message          

6 Likes

Thanks for the automation.

Can you add a OR condition so multiple contact sensor as well as corresponding message for that door? It will help keep the number of automations required for all the doors to one automation

Hello,

I am using a Iris zigbee open/close sensor. The device class comes up as opening. Anyway you can update this to also use the opening class?

Can you make it turn off the xbox after 30 retries (j/k)

2 Likes

Yes, just install a shelly switch in their room wall power outlets :wink:

Hey thanks for this, I’m trying to use it for when the kids open the freezer drawer and don’t close it… It worked once but now there is always this error when the integration runs…
*extra keys not allowed @ data['device_id']*

You could also just change the device_class to door via Settings → Customizations :ok_hand:

I had the same issue (extra keys not allowed @ data['device_id']) and discovered that when selecting the speaker, I had to use “Choose entity” rather than “Choose device”. Choosing it as an entity resolved the issue for me.

Please make it usable with Alexa…

Alexa say current "Sorry TTS can only used with Alexa notify. Please use… "