Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
HA Blueprint Script for a google-translate-say message. Home Assistant
blueprint:
name: TTS Google Translate Say Message_2021-08-26
description: A script that uses tts google_translate_say to send a message to a google speaker
# Community link for blueprint: https://community.home-assistant.io/t/script-blueprint-for-google-translate-say-and-tts-cloud-say-message-not-an-automation-blueprint/333199
source_url: https://gist.github.com/SirGoodenough/ecf747f3bc399f088a13853cf80ec12b
domain: script
input:
speaker_target:
name: Device(s) to speak thru
description: This uses google_translate to send a text message
selector:
entity:
domain: media_player
speaker_language:
name: Speaker Language
description:
Check the complete list of [supported languages]
(https://translate.google.com/intl/en_ALL/about/languages/)
(languages where -Talk- feature is enabled in Google Translate)
for allowed values.
This defaults to en (english) so you do not have to send the
data from the calling script if you don't need to change it.
default: en
announcement_message:
name: Spoken message
description: "Type your message here:"
default: It matters not what I say.
selector:
text:
multiline: true
mode: queued
sequence:
- service: tts.google_translate_say
data:
entity_id: !input 'speaker_target'
message: !input 'announcement_message'
language: !input 'speaker_language'
@SirGoodenough

This comment has been minimized.

Copy link
Owner Author

@SirGoodenough SirGoodenough commented Aug 27, 2021

⬇️ Get Started

Updates will be published on my GIST repository with the rest of my Home Assistant Blueprint collection.

Option 1: My Home Assistant

Click the badge to import this Blueprint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Option 2: Direct Link

Copy this link if you want to import the blueprint in your installation.
https://gist.github.com/SirGoodenough/ecf747f3bc399f088a13853cf80ec12b

📄 Description

At the point of release of this Script Blueprint, the infrastructure to generate the calling script with the !inputs does not yet exist. This will have to be done manually.

This version uses Google_translate_say to send the message. This is the default TTS in Home Assistant.

I have my TTS configuration looking like this. You may need to adjust the blueprint if yours is different:

- platform: google_translate
  service_name: google_translate_say
  language: 'en'

You can import the script blueprint via the button above or manually as below, however it does not show in the UI as there is no Script Blueprint UI and it is not an Automation Blueprint.
To import this Blueprint:

• Open Home Assistant with administrator privileges and on a Lovelace screen, click anywhere in the main entity area and type the letter ‘c’. A selection box should pop up. Type blue and select the button to navigate to blueprints. You can also find blueprints by selecting configuration from the left menu and then blueprints from the center menu.
• Once there, click on the ‘Import Blueprint’ button in the lower right side of the main screen.
• In the ‘URL of the blueprint’ line type or paste in the URL of my Blueprint. I have the blueprint stored on my Public GIST on GitHub:
https://gist.github.com/SirGoodenough/ecf747f3bc399f088a13853cf80ec12b
• Since this is a Script, and not an Automation, it will not show in the UI. Use an editor such as VSCode to verify it is there and to make any changes.

This is a very simple sample test case, I wanted to see if it would work...

Here is a sample script you can edit and use to call the Blueprint and use it. This will also have to be manually edited.

You must remember to reload scripts or restart after you make or edit this file or it will not work as expected. (From Lovelace screen type c then scr then reload scripts.)

scripts:

blueprint_test2:
  alias: Test message Blueprint google_translate_say
  description: 'Blah Blah'
  use_blueprint:
    path: /config/blueprints/script/SirGoodenough/tts_google_transate_say_message_script.yaml
    input:
      speaker_target: media_player.living_room_speaker
      speaker_language: es
      announcement_message: No importa lo que diga.

Changelog

  • 2021-08-26: First blueprint version 🎉

All My Blueprints

Contact Links or see my other work:

What are we Fixing Today Homepage / Website: https://www.WhatAreWeFixing.Today/
Channel Link URL: (WhatAreWeFixingToday) https://bit.ly/WhatAreWeFixingTodaysYT
What are we Fixing Today Facebook page (Sir GoodEnough): https://bit.ly/WhatAreWeFixingTodayFB
What are we Fixing Today Twitter Account (Sir GoodEnough): https://bit.ly/WhatAreWeFixingTodayTW
Discord Guild: (Sir_Goodenough#9683) https://discord.gg/Uhmhu3B

If you want to support me:

Buy me Coffee: https://www.buymeacoffee.com/SirGoodenough
PayPal one-off donation link: https://www.paypal.me/SirGoodenough
Cash App $CASHTAG: https://cash.me/$SirGoodenough
Venmo cash link: https://venmo.com/SirGoodenough

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment