Tts configuration both Alexa and Google

I’m running Hass.io 0.85. My configuration.yaml has:
tts:
- platform: google

I also have:

media_player:

  • platform: alexa
    email: !secret amz-email
    password: !secret amz-pwd
    url: amazon.com

When I open my echo dot from the Overview pane and asked it to speak ‘hello’ Alexa responds that I must use the alexa tts service. A popup shows up saying it called google_tts. When I open media_player.alexa_tts from services and specify the entity_id for my dot, it works.

So I modified my configuration.yaml and added
tts:
- platform: google
- platform: alexa

(as if I knew what I was doing…) and the configuration check says
Platform not found: tts.alexa

I checked alexa.py and it says VERSION 0.9.6. I got this from the “testers needed” forum discussion.

My questions are 1) how do I get alexa to use the correct tts platform and 2) can I have both Google Home and Alexa platforms at the same time?

Many thanks in advance.

Hi Bart , have you figured out what you need to enter in TTS Section of config.yaml file as i am also looking for that answer

This is by no means the answer, but I also have a similar related post on here at the moment.

I have been able to get a message spoken on Alexa by going to the Service button in the DEv Tools and manually typing the service and service data manually, as described in the KEaton Taylor post.

ALthough I have not been able to successfully message to alex from an action in my automations.yaml file, or to be able to TTS from the media player in the overview tab.

@bart56, @shaneprince

This is how you achieve it

image

Yes the call service works ,however when trying from the echo dot tile itself from the Home Screen , where it gives you the option to type text

that won’t work because it is not part of the google_tts domain you can only call it from an automation, script etc.

Thanks for the help.

Yes - same here Shaneprince. The service always worked, but I can’t figure out how to tell the echo devices to use it instead of google_tts.

@jimpower Are you saying there is no way to assign the alexa entities the media_player.alexa_tts service? I’ve been looking through all the yaml files to see how that might be done.

there is away as I have seen it done, I just cant get there. I am not sure how to created the action to send the text to alexa.

Hopefully someone can help with a valid action that works

  action:
  - data:
      entity_id: media_player.kitchen
      message: Hello Rob Welcome home
    service: media_player.alexa_tts

Something like above but its wrong!

@BigRob can you test it with the services tab like my screenshot above does it work from there?

Edit you have spelt entity wrong.

@bart56 yes you can through an automation like any other TTS action, you just can’t do it from the TTS action in the front end.

use like this in your automation

  action:
  - data:
      entity_id: media_player.your_media_player
      message: This is your message
    service: media_player.alexa_tts

Unfortunately Yes. Thanks to jimpower and BigRob, I find I can only address the Alexa through automations. I tested one with device_tracker that welcomes me home in automations.yaml:
- id: ‘123547476435’
alias: Bart Home
initial_state: True
trigger:
- entity_id: device_tracker.00_ae_fa_ez_xa_ya
from: not_home
platform: state
to: home
condition: []
action:
- data:
entity_id: media_player.bob_s_dot
message: Hello Bart, glad you are home
service: media_player.alexa_tts

unfortunately I can’t just type in this code - have to use the configuration tab then automations which is kind of clunky. I tried to type in the same thing but hassio would not recognize it. I’m guessing the id needs to be generated, not made-up. It could be that I’m doing something else wrong but this works. Sorry if the indentations aren’t exact. When I do a copy of the yaml code and paste here using preformatted text, it messes up the indents so I tried to fix it.
Many thanks.

to get the code to look right just put 4 spaces before each line.

I have corrected the spelling. That was causing my issue the other day too lol…

You could set up a card with softswitches configured to activate “Canned messages” ones that are pre made in automations.yaml until the TTS for alexa is available in the media player frontend.

Good for me at the moment I only want TTS for automations.

@bart56

What you can do is create a speech script and then call on that this is one I call every morning

#################################################################
#                                                               #
#                       Speech Scripts                          #
#                                                               #
#################################################################

script:
  james_briefing:
    alias: James Briefing
    sequence:
      - service: media_player.alexa_tts
        data_template:
          entity_id: media_player.kingia_main
          message: >
            {% if now().strftime("%H")|int < 12 %}
            Good morning James.
            {% elif now().strftime("%H")|int < 18 %}
            Good afternoon James.
            {% else %}
            Good evening James.
            {% endif %}
            It's currently {{states.sensor.temperature_158d0001f56350.state|round}} degrees outside. Today will be {{states.sensor.bom_gc_forecast_detailed_summary_0.state|replace(".", "")}} with a {{states.sensor.bom_gc_forecast_chance_of_rain_0.state}} percent chance of rain.
            {% if now().strftime("%H")|int < 9 and now().strftime("%w")|int > 0and now().strftime("%w")|int < 6 %}
            The current drive to Powertec in traffic is {{states.sensor.commute_to_work.state}}
            {% endif %}

In your automation your action is to call script.james_briefing

You can now also call this from the dev tool also

If you want to format your code correctly highlight your code and then use the tool at the top of the post window that looks like this </>

Thanks Jim. If I understand you correctly, I paste it first, then highlight what I pasted, then hit the </> symbol.
I will give that a try next time I post some code.

I do have speech working using alexa_tts using an automation and device_tracker. Sadly, my Galaxy Note 5 seems to be turning off wifi every so often scaring the bejeezus out of my wife and daughter. I’ll try using the ping tracker platform next and see if that fixes the false “Home” / “Away” recognition.

Bart

I think you will find ping is the same as your phone turns off wifi when it goes to sleep. I can recommend using the GPSlogger component for accurate presence detection. Accurate presence detection is the purple unicorn of home automation feel free to have a read of my repo for tips on using a multi pronged attack in regards to presence detection.

Look in packages for presence

Many thanks Jim.
Your whole setup is very impressive and the presence detection is amazing. It is so comprehensive it borders on stalking - but as DrzZ says: “if it’s family, it’s not stalking…”
I could learn a lot from your work, but right now I have to crawl before I walk. I have the Alexa announcing my presence, but the on-off-sleep cycle of the wifi on the phone will need to be addressed. I’ll read up on the gpslogger component to see how that works. I’m also having trouble using the HADashboard as it can’t find my entities. Weird, but something to do with duckdns maybe.
Bart

1 Like