Broadcasting messages on Google Home

Hello,

Beginner in the Home Assistant world, I am asking for your help so that my Home Assistant broadcasts messages on my Google Home and this under NODE-RED. And yes I like this graphical interface!

With the development tool, the text is broadcast on both Google devices.

The problem is with NODE-RED, I tried but I still have errors…

I can’t find a complete tutorial on the net explaining how to do it! Namely setting up the configuration file.yaml as well as a functional flow with the associated Json file.

I am attaching screenshots

Thank you in advance for your help.

Michel

Node-RED is quite separate to Home Assistant, so it is a learning curve for both Home Assistant and for Node-RED.

You will not always find tutorials on the internet, as not many people use both Home Assistant and Node-RED, and few use it for something very specific like this.

Also this is a little complicated, since there are different settings depending on the exact TTS action (service) you are using. It confuses even those of us who pretend that we understand.

With any Action, it is important that you can run the Action in Home Assistant first. If it does not work there, it will never work in Node-RED.

As you are using action

text-to-speech.speak (tts.speak)

you will need to set a target service, as well as the message, and the language. This is important for the correct settings in Node-RED. If any setting is wrong, it will not work.

When you move to Node-RED, you use nodes. There is no file.yaml. The settings are done in the node UI editor.

In Node-RED

  • you need the WebSocket nodes (the nice blue ones)
  • you need to have the WebSocket HA server configured correct (this connects to Home Assistant from Node-RED)

I am going to assume that you have Node-RED as an add-on in Home Assistant and that your Home Assistant server configuration node is correctly set up and is working.

Then, in the Node-RED editor

add one Inject node (so you can manually start a flow)
add one Action node (so you can call the tts action in Home Assistant)

Here is the setting for the Action node

  • I have renamed my HA server, but your node should already show ‘Homeassistant’
  • the Action you are using is tts.speak (parler)
  • this action requires a ‘target’, and you are using ‘Google translate fr’ so you need to add an entity and select the correct one from the list
  • then you need to add an object in the Data field with all the options

The Data object requires all the settings for the message and language. This is very similar to the YAML used by Home Assistant, but must be in JSON.

The settings you require are

{
   "cache": true,
   "media_player_entity_id": "media_player.kitchen_display",
   "message": "test de bonne diffusion",
   "language": "fr"
}

which gives you the correct media player you want (change for your one), and the message, and the language. Cache will hold the generated audio file for re-use.

I have tested this using my settings, and it fonctionne très bien for me.

Once you have this working, you can change the Data object (as long as you keep the J: option for JSONata) and use

{
   "cache": true,
   "media_player_entity_id": "media_player.kitchen_display",
   "message": payload,
   "language": "fr"
}

which will accept an input message with the standard msg.payload set to a message string. Then your Action node will speak any message you send to it.

I hope this helps you to get started. Bonne chance

Good evening Geoff,

First of all I have to thank you for your answer.

I have just configured my node following your recommendations, and it works!!!

Thank you very much Geoff, I searched by myself but I did not find!

Next work, set up some voice commands on Google Home and action performed by Node-red. I think I will need you!!

Thanks again

Michel

I’m having issues with tts.speak

It makes the ‘chime’ sound but doesn’t speak the message.


Have you tried the Action in Home Assistant? Have you tried adding a language?

From memory I think language is not optional for this Action.

This is a known hiccup. There is an integration that combines the sound and tts response to correct it.