Can't get tts to work. (new user)

I have home-assistant installed on a Raspberry Pi 3 under Gentoo linux. The installation (emerge) completed without incident and the server is responding as expected. It has discovered my devices without a problem including my Google Home Mini which I am trying to access. I am starting by simply trying to get the google-home speaker to say something. My configuration.yaml is the default and includes a tts: entry with - platform: google. The device shows up on the overview screen as “D Office speaker” and when the “on/off” button for it is pressed, I hear a chirp from the speaker and is shows “Idle”. So far so good…

Then, from the “Services” screen I enter “tts.google_say” in the “Service” entry field. In the “Service Data” field I enter:

{"entity_id":"media_player.d_office_speaker","message":"test"}

I then click “CALL SERVICE” which responds “Service tts/google_say called.”. However, there is no sound from the device. The Home Mini is silent.

In the log I see the following message:

Error executing service <ServiceCall tts.google_say: entity_id=['media_player.d_office_speaker'], message=test>

follower by a python traceback which concludes:

for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
TypeError: getaddrinfo() argument 1 must be string or None

Also, this same error occurs immediately in the error log on server startup with no input or action from me.

I have googled extensively for this error and found nothing.

Does anyone have any suggestions? Please let me know what additional information I can provide to track this down.

Thanks!

P.S. How do I enter code in “code blocks”? Also, I hope this is the correct place to post this!

Here is my working config:

tts:
  - platform: google
   language: 'it'
   cache: true
   cache_dir: /tmp/tts
   time_memory: 300

Don’t forget to create the /tmp/tts directory.

Then, this is the action in automation:

  action:
    - service: tts.google_say
      entity_id: media_player.living_room
      data:          
        message: >
          This is the message that Google Home will say

Take care of entity_id name who is your Google Home in HA.

Thank you, I tried what you have exactly but with my own entity_id and get the same error as first posted.

I believe the problem is more basic that tts. As mentioned, I receive the error:

File "/usr/lib/python3.5/socket.py", line 733, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
TypeError: getaddrinfo() argument 1 must be string or None

at startup before any actions are attempted, then again on each attempt to run a tts action.

Can anyone address the getaddrinfo() problem. I am hopeful that once this is resolved the tts will start working.

Thanks!

I have read not experienced that sometimes there is a discovery problem that affects chromecast devices. Since the TTS uses the chromecast component for the TTS this may be hitting you. Try explicitly setting the chromecast component and IP of your google home and restart HA and see if that helps.

tts read from base_url as well. You base url has to be with port example

http:
  base_url: http://ha-ipaddress:8123 <=== with ha port
  api_password: YOUR_PASSWORD

I added:

http:
base_url: http://firewall:8123

The getadderinfo() error persists. I have not setup the optional password.

UPDATE:

I have installed homeassistant 0.68.1 on another machine. I get the same getadderinfo() error, but the following worked:

{"entity_id":"media_player.d_office_speaker","message":"test"}

What is really weird is that if I change “test” to “testing” (or anything else) if fails. It works repeatedly and reliably saying “test”, but every other string fails with the getadderinfo() error.

How can that be?

It still fails (even with “test” on the PI).

Since it works with “test” on the other machine, I don’t think it would be a chromecast issue.

http://ip:8123 <== it is :port not /port
when you change configuration also need to restart your HA.

Once ha loaded. Go to your media_player.d_office_speaker from the frontend. click on the media player. There will be input text for you to type anything you want this media player to speak. then press >

Thank you, yes, I used “:” not “/” in the config file. …just mistyped the message…

I am not clear where you mean by “Go to your media_player.d_office_speaker from the frontend.” Do you mean on the Overview page?

I tried that and there is no place to enter “>”. I pressed > anyway and nothing happens. I click the “on/off” button and it causes the speaker to chirp when it turns on. …but no input field there. I must not be on the right screen. Please clarify.

Still, how can it work with the string “test” and fail with any other string?

Thanks again!

The media player on ha front end. When you click on the media player on front end there will be tts on that media player. You can type the text there and that media player will speak out.

I apologize for the misunderstanding, but I do not find a media player on the ha frontend. Would you be so kind as to elaborate on exactly how to find it? Is it possible it is not configured on my system? The only thing I can find that is even close is:

media_player.d_office_speaker

but there is no tts there.

Thanks so much for your indulgence!

On your Web Interface do you have the Media Player cards? Like so…

https://i.snag.gy/f86YMi.jpg

Yes, in particular one that says “D Office speaker”. But there is no input field labeled tts or otherwise near it or anywhere. I have clicked every button, menu and sub-menu on this item and see nothing of the kind. Please advise if you understand what Sunonline is referring to. Thanks!

If you can show your config of D office speaker , and is this speaker attached to Pi3 or ?

In the config file named entity_registry.yaml, the installation created the following entry:

media_player.d_office_speaker:
  name:
  platform: cast
  unique_id: 23c75b47-0aaf-feab-00d9-596fa0f0d52c

There is no other reference to it. The speaker is a Google Home Mini and not attached to anything other than the wifi network.

google cast audio and video will not show or display on frontend if it is off (not connected to network).

To get the best result of the media player if you can put ip address in the configuration. also put discovery: in configuration.

media_player:
  - platform: cast
    host: 192.168.1.10 <-- optional

Once you have set up media player and also discovery in configuration. Try put # in front of every line of old media_player.d_office_speaker. Then restart your HA.

Name of the cast device can be done in customize later.

Once Restart, with your cast device also has to be turn on. You would be able to check this media player for entity_id.

If you media player doesn’t show up on front end. put it in group so it can be seen on frontend.

Thanks, I will try. But I have question…

When I click the “ON” button on the frontend media_player entry for this Google Home (D Office speaker), I immediately hear a chirp from the Home and it displays its state as Idle. It appears from your explanation that this would not happen if it was not being correctly discovered. Am I correct?

It is normal that it show idle as it connected to network. So your media player display on frontend. Click on that media player it will pop up another window. On this popup window there is an input text that you can type anything for this media player to speak out.

Click where on the media player? On the Play button? I have clicked on all buttons, menus and sub-menus on the media player and the only item with an input field asks me to rename the item.

Please indicate exactly which and where to click to get to the “text so say” field. Thanks!

You see the three dot on your media player?

Look at this post. there is picture. Article 4.1