Smart Home Announcements on Google Home Speakers with Home Assistant

Smart Home Announcements on Google Home Speakers with Home Assistant

For a long time, I wanted to use my Google Home speakers in my smart home setup for more than just music and timers — I wanted automated announcements.
Whether the egg cooker has finished, the trash is being collected, or someone rings the doorbell — a short spoken message at the right time can make everyday life much easier.

Home Assistant makes this possible through its built-in Text-to-Speech (TTS) service.
However, there’s a small annoyance: after a TTS message plays, the speaker often stays stuck in playback mode, showing the TTS icon or the last displayed image indefinitely. It takes a while before the default screen (like the clock) reappears — or you have to stop it manually.

That bothered me — so I developed two custom Home Assistant scripts that fix the problem once and for all.

What Is a Script in Home Assistant?

In Home Assistant, you can control automation workflows not only through triggers and conditions but also through scripts.
Scripts are predefined sequences of actions that can be started manually or called by other automations.
They make it easy to manage recurring routines centrally — such as announcements, lighting, or scene control — and adjust them in one place.

The Problem and the Idea Behind My Script

At home, I use about 15 Google Home devices, including multiple Google Nest Hub displays and Google Home Minis, spread across my apartment and my parents’ home (all within the same network).

When setting up my automations — for example, calendar reminders, the egg cooker, or door warnings — I kept running into two problems:

  1. The media playback would stay active after the TTS message finished.
  2. I had to manually create multiple “media stop” actions for each speaker.

That quickly became messy and hard to maintain.

So I created two universal scripts that combine all the necessary functions into a single sequence:

  • Script “Announcement – TTS”
    Plays a text-to-speech message on selected Google speakers and automatically stops playback afterward.
  • Script “Announcement – Media”
    Additionally displays an image — for example, a warning symbol or the icon of the trash bin to be collected (green, yellow, or black) — and then stops playback as well.

Script Structure

Both scripts are modular and use variables that can be customized when executed:

  • varmessage: The message to be spoken
  • varspeaker: List of Google Home speakers
  • varrepeat: Number of repetitions
  • vardelay: Delay between announcements
  • varimage (optional): Image file to display on Nest Hub screens

This modular setup allows the same script to be reused in many automations – for example, calendar notifications, device alerts, or safety warnings.

Example: TTS Announcement on Google Home Speakers

This script speaks the message on all selected speakers and then automatically stops playback, returning the devices immediately to their idle state.

home-assistant-google-text-to-speech-durchsage-01

home-assistant-google-text-to-speech-durchsage-01

home-assistant-google-text-to-speech-durchsage-02

home-assistant-google-text-to-speech-durchsage-02

sequence:
  - sequence:
      - repeat:
          count: "{{varrepeat}}"
          sequence:
            - repeat:
                for_each: "{{ varspeaker }}"
                sequence:
                  - action: tts.speak
                    metadata: {}
                    data:
                      cache: true
                      message: "{{varmessage}}"
                      media_player_entity_id: "{{ repeat.item }}"
                    target:
                      entity_id: tts.google_translate_de_de
            - delay: "{{ vardelay }}"
      - repeat:
          for_each: "{{ varspeaker }}"
          sequence:
            - action: media_player.media_stop
              metadata: {}
              data: {}
              target:
                entity_id: "{{ repeat.item }}"
alias: Durchsage - TTS
description: ""
fields:
  varmessage:
    selector:
      text: null
    name: varMessage
    description: Nachricht für die Sprachausgabe
  varspeaker:
    selector:
      entity:
        multiple: true
    name: varSpeaker
    description: Lautsprecher für Sprach und Bild ausgabe
    required: true
    default:
      - media_player.eg_wohnzimmer
  varrepeat:
    selector:
      number:
        min: 1
        max: 100
    name: varRepeat
    default: 3
    required: true
  vardelay:
    selector:
      duration: {}
    name: varDelay
    default:
      hours: 0
      minutes: 1
      seconds: 0
    description: Wartezeit zwischen Druchsagen, Standard 1min

Example: TTS Announcement with Image on Google Nest Hub Displays

The second script expands the functionality by displaying an image on your Nest Hub screens — perfect for visual alerts or reminders.

sequence:
  - sequence:
      - alias: TTS
        if:
          - condition: template
            value_template: "{{ varmessage != '' }}"
        then:
          - repeat:
              for_each: "{{ varspeaker }}"
              sequence:
                - action: tts.speak
                  metadata: {}
                  data:
                    cache: true
                    message: "{{varmessage}}"
                    media_player_entity_id: "{{ repeat.item }}"
                  target:
                    entity_id: tts.google_translate_de_de
          - delay:
              hours: 0
              minutes: 0
              seconds: 10
              milliseconds: 0
      - alias: Bild
        repeat:
          for_each: "{{ varspeaker }}"
          sequence:
            - target:
                entity_id: "{{ repeat.item }}"
              data:
                media:
                  media_content_id: >-
                    media-source://media_source/local/Media/Nachrichten/{{varimage}}
                  media_content_type: image/jpeg
                  metadata:
                    title: "{{varimage}}"
                    thumbnail: null
                    media_class: image
                    children_media_class: null
                    navigateIds:
                      - {}
                      - media_content_type: app
                        media_content_id: media-source://media_source
                      - media_content_type: ""
                        media_content_id: media-source://media_source/local/Media
                      - media_content_type: ""
                        media_content_id: media-source://media_source/local/Media/Nachrichten
              action: media_player.play_media
      - delay:
          hours: 0
          minutes: 1
          seconds: 0
          milliseconds: 0
      - alias: Media Player - Stop
        repeat:
          for_each: "{{ varspeaker }}"
          sequence:
            - action: media_player.media_stop
              metadata: {}
              data: {}
              target:
                entity_id: "{{ repeat.item }}"
alias: Durchsage - Medien
description: ""
fields:
  varmessage:
    selector:
      text: null
    name: varMessage
    description: Nachricht für die Sprachausgabe
  varspeaker:
    selector:
      entity:
        multiple: true
    name: varSpeaker
    description: Lautsprecher für Sprach und Bild ausgabe
    required: true
    default:
      - media_player.eg_wohnzimmer
  varimage:
    selector:
      text: {}
    name: varImage
    description: Pfad zum Bild
    required: true
    default: Achtung.jpg
  vardelay:
    selector:
      duration: {}
    name: vardelay
    description: Anzeigedauer des Bildes
    default:
      hours: 0
      minutes: 1
      seconds: 0

Real-World Use Cases

I use these scripts for a wide range of automations, such as:

  • Trash collection or calendar reminders (from Google Calendar integration)
  • Status messages from smart devices, like the egg cooker (via Tasmota smart plug (*))
  • Door, garage, or window alerts (via zigbee contact sensors (*))
  • Visitor or call notifications (via Google Home Mini / Nest Hub)
  • Automatic event announcements in Home Assistant

The scripts are flexible enough to fit into almost any automation.
If I ever need to make a change, I only update the script – not every individual automation.

Benefits of This Script

  • Centralized TTS announcements across multiple speakers
  • Automatically stops playback afterward
  • Optional image display on Google Nest Hub screens
  • Repeat announcements multiple times
  • Easy variable customization
  • Clean, reusable, and scalable setup

FAQ

Can I use other languages for the announcements?
Yes, just change the TTS service to another language, such as tts.google_translate_fr_fr or tts.google_translate_de_de.

Does it work with Alexa or Sonos speakers?
Yes, with small modifications — you only need to change the TTS service and entity names.

Do images have to be stored locally?
No, you can also use external image URLs or files from your media folder.

What happens if a speaker is offline?
Home Assistant automatically skips that entity and continues with the others.

Glossary

Home Assistant: Open-source smart home platform for automating devices and routines.
TTS (Text-to-Speech): Converts text into spoken audio.
Media Player Entity: A playback device in Home Assistant such as a speaker or display.
Automation: A set of actions triggered by events or conditions.
YAML: A structured configuration language used for scripts and automations.

(*) Affiliate Links

Durchschnittliche Bewertung 0 / 5. Bewertungen: 0

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top