Help with Scrips and TTS

Hi trying to get TTS and scripts working and been following this guy kind of tutorial http://philhawthorne.com/j-a-r-v-i-s-inspired-announcementgreeting-for-home-assistant/ but having issues with getting script set up. Error I’m getting at the moment is
7-01-04 20:36:12 homeassistant.bootstrap: Invalid config for [script]: [Javis_Greeting] is an invalid option for [script]. Check: script->script->Javis_Greeting. (See ?:?). Please check the docs at https://home-assistant.io/components/script/
my setup is saved in my github here https://github.com/MREllyFont/Home-assistant any help would be great thanks
El

Post the relevant YAML for the script here. Use preformatted text.

configuration

    homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: !secret latitude
  longitude: !secret longitude
  # Impacts weather/sunrise data
  elevation: 38
  # metric for Metric, imperial for Imperial
  unit_system: metric
  time_zone: Europe/London



############
# INCLUDES #
############

group: !include includes/groups.yaml
device_tracker: !include includes/device_trackers.yaml
scene: !include includes/scenes.yaml
light: !include includes/lights.yaml
sensor: !include_dir_merge_list includes/Sensor
automation:  !include_dir_merge_list includes/automation
# notify: !include includes/notify.yaml
# camera: !include includes/cameras.yaml
script: !include_dir_merge_named includes/scripts


http:
  api_password: !secret http_password
  ssl_certificate: !secret ssl_certificate
  ssl_key: !secret ssl_key


# Checks for available updates
updater:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time.
history:


# Discover some devices automatically
discovery:

# View all events in a logbook
logbook:

# Track the sun
sun:

# Weather Prediction

tts:
  - platform: google
  
input_boolean:
  beths_wake_up:
    name: Beth Working Weekdays
    initial: on
    icon: mdi:alarm
  beths_saturday_wake_up:
    name: Beth Working Saturday
    initial: off
    icon: mdi:alarm   
  elliots_wake_up:
    name: Elliot working weekdays
    initial: on
    icon: mdi:alarm
  turn_off_everything:
    name: turn off everything
    initial: on
    icon: mdi:switch
    
mqtt:
  broker: 127.0.0.1
  port: 1883
  client_id: home-assistant-1
  username: pi
  password: raspberry`

and script file

Javis_Greeting:
  sequence:
    - service: tts.google_say
      data:
        entity_id: media_player.living_room_speaker
        message: Hello Beth. How was your day?

I think you need

alias Javis_Greeting:

to be precise:
alias: Javis_Greeting

:slight_smile:

Changed it to this now

Javis_Greeting:
  alias: Javis_Greeting
  sequence:
    - service: tts.google_say
      data:
        entity_id: media_player.living_room_speaker
        message: Hello Beth. How was your day?

still getting the same error tho

Try lower-casing the script name. You were fine not having an alias. And you can have an alias with spaces.

javis_greeting:
  alias: Javis Greeting
  sequence:
    - service: tts.google_say
      data:
        entity_id: media_player.living_room_speaker
        message: Hello Beth. How was your day?

I believe this is caused by the fact that you are using script: !include_dir_merge_named includes/scripts. in this case your file name will render as the script name if I’m not mistaken.

so your first line should be removed and the contents of your script file should look like this:

alias: Javis Greeting
sequence:
  - service: tts.google_say
    data:
      entity_id: media_player.living_room_speaker
      message: Hello Beth. How was your day?

get the spacing right as alias should start a position 1

Cheers looks like I have scripts set up correctly think it was the capital letter which caused the issue.
but I’m not getting the google tts to output to the chromecast audio speaker at the moment.its a sony srs-zr5 have I got something else incorrectly set up aswell as cant see any errors in the log

I’m still stuck on getting my speaker to play the TTS file as when I run the script I can see a new file being created in the TTS folder and when I play them they are all correct. When I do run the script and I’m casting music over to the speaker the music will stop but that’s it so not sure what’s going wrong as it must be talking to the speaker in some way.
The script I have at the moment

javis_greeting:
  alias: javis greeting
  sequence:
    - service: tts.google_say
      entity_id: media_player.living_room_speaker
      data:
        message: 'Hello testing. Testing.'
1 Like

did you get your issue resolved? if so, how?

If you play TTS it will stop what is playing.

TTS is nothing more than a mp3/wav file that is streamed to your media player and therefore it will stop what is being streamed the moment it gets another stream offered.

To my knowledge there is now function to restart the previous stream. Maybe somebody else knows…

No sorry I didn’t get this working. I’m guessing I have some thing setup wrong as it won’t play on either my Chromecast v1 or Sony speaker with Chromecast built in. The script works tho as it produces the mp3 in the tts folder but I just never get it to play the file?

I think I have just run into the same issue. Things seem to go through the motions but no audio is output to the speakers.

I’ve tried a few changes and playing around with the code and go no where. If you have any more luck please post back on what you did would be greatly appreciated. also what tpye of speakers are you trying to play the tts through?

think this might help actually just saw this post and its has adding homeassistant user to audio group
by sudo usermod -a -G audio homeassistant
not sure how I meant to do this is it just run that code in my putty or log in to the virtual area of home assistant. so any assistant would be helpful

The problem as I have run into it is, at least with Google Home, it has the DNS entries hard wired to point to google DNS (8.8.8.8). By default it will look at the base_url setting in the config to get the base URL for your HA server. If you are like me and run your own DNS it will not work because the google home is going to public DNS to look up “myha.myhome.com” or something like that and it will not get an answer back because public dns doesnt’ know about your private IP space.

Your solution is to either use the IP address in the base_url in your config or modify a public DNS entry to point to your internal IP of your home assistant box.

Can you use the host file to point the FQDN to an internal IP.