TTS to Google Mini using Node Red

I am encountering a strange problem :slight_smile:

Below you can find the flow I am using, the left hand side node will trigger the flow and their payload is ‘Home’. What I noticed is that when the Welcome Home is triggered, it will just say “Home” instead of saying what is written in the Message Box.

When I use the Injection box is works fine … any help pls? :slight_smile:

I don’t know what is the yellow node you are using but a probable cause could be, msg.payload is overwriting your message configured inside the node properties. if that’s the reason, one solution could be to put a change node before yellow one to empty the payload.

I use the Call Service Node for this using tts.google_say service, and it generally works.

Where I have had issues are overlapping commands. If something else is also accessing the device, the actions get interrupted. I have several places that announcements are made, and in particular volume is changed. For example, if I issue google_say then immediately change the volume, what I am saying is cut off, a delay is needed. What I found is I needed to package this all up in a subflow and wrap it all in a semaphore, so that only one flow at a time could be touching the media player.

Is it possible that the two triggering paths are both firing and interfering with each other? Remember that left side will trigger twice if both fire. You might put the inject over there and see what happens (with suitable payload).

I think you are issuing some kind of direct cast to the google home, so your experience may be different of course. If you use the cloud or direct google assistance, you might try the tts.google_say instead of that yellow node.

yes you are correct … modified the payload and it works fine

that sounds like a good idea … do you have an example how to use Call Service node?

I’m not quite sure how to post node red examples best, but here are the settings:

Name: Say Status
Server: Home Assistant
Domain: tts
Service: google_say
Entity_id: media_player.master_bedroom_mini
Data: {"message":"test message"}
Merge_context: empty
output_location: None

thanks will give it a try

I am trying to use the semaphore node you described here but still am having issues getting it to wait till the announcement of the call service node is completed. When my call service node receives multiple messages at once it only plays one of them as the others are interrupted by the following message. The call service node is sending an output almost as soon as it gets an input which then triggers the next message. I can add a delay node after the call service node which will prevent the next message from going of for a certain amount of time but depending on the messages coming in to the node i the delay times would be different for each one. If i use a generic time delay of one minute i may have 30 to 40 seconds of silence on one message but might cut off another. Is there any way to determine when the node is actually complete with processing so i would get real time delay based on when it is finished and not an arbitrary time i put in?

I think the actual announcements are asynchronous, i.e. the node red node completes before they are done. The semaphore node can prevent you have having multiple node-red threads firing at once, but you need to put a delay in each of them (protected by the same semaphore) that will wait long enough for the announcement to complete.

E.g. in one series: Take, Announce, Wait, Leave

The take/leave prevents you from having two invocations of this flow going at once, the wait gives the announcement time to finish.

Unfortunately announcements from other sources, like responses to voice commands, can also intrude and I have no idea how to block those.

With this node notifications are automatically queued and you also can define notifiations with priority flag

https://flows.nodered.org/node/node-red-google-notify