Node-Red Action node for tts.microsoft.say

Before node-red v4.0.3 the action node for service TTS did include an entity such as media.player_ESPMuse_Muse_Luxe. After v.4.0.3 when service: tts.microsoft.say has chosen, the target selection has gone, and at left hand side of Deploy button an exclamation point about the node with the following warning message has shown as below.

  • Entity ID ‘media_player.livingmuseluxe’ should be in the data property, not the target property, for the selected action.

How do I add the entity id in the json data field? Right now for some reason even there is warning, the flow still can send the speech to the correct media_player. But I am pretty sure it won’t work if there is new flow in the future which calls media_player TTS service with node red.

Services have become actions.

The Call service node has become Action node.

The target entity is now set within the data object.

Old service call:

New action:

The Domain and Service fields have been combined into one Action field
The Entity field has gone, and the entity is now added to the Data object as “entity_id”: “media_player.my_device”

Note that formally the target Entity was a UI field with dynamic entity search, and now you have to type in a string yourself, it is important to look this entity up and copy across correctly.

The notes / documentation for Actions within Home Assistant have been updated, however the Action node example at the bottom has yet to be changed to include the entity_id field.

If calling the action from an input message, then yes the msg.payload object needs to be something like

{
    "action": "tts.google_translate_say",
    "data": {
        "entity_id": "media_player.kitchen_display",
        "message": "it works"
    }
}

Hope this helps

2 Likes

Really annoying and less user friendly (when configuring in nodered), but thank you for showing how to solve it. Just a shame I have 50 of these issues and have to manually change everything.

1 Like

Do you have the newer set of nodes installed? Are they still functioning as is and does the warning tell you when it will be depreciated? The changes are reflective of the structural changes in HA. Some times don’t line up well and/or it’s an unforeseen consequence changing to the new format.

The latter is usually addressed in further releases. If it is working you might want to hold off and see if it’s addressed in a newer version.

Web socket nodes are updated more frequently than the addon. Those updates are not pushed to the user but can be installed by using the palette manger.

All good points. I just updated the Home Assistant websocket nodes to the latest version, but unfortunately that didn’t help and it doesn’t seem to match the documentation anymore:

What was once call service is now actions and in the documentation it shows that you can use the UI to add targets, which is what I did and very user friendly:

However, now it says that you cannot use targets but have to add it to the data property (JSON) instead of the nice autocomplete fields, which is going to take a while with 50 action node errors:
Skærmbillede 2024-10-22 kl. 21.21.05

I wish there was a was to automatically convert the old style call service nodes to action nodes where the old fields including entities were merged into the data JSON.

Hi Guys, … this might be a sub/side/parallel thread on this topic (it doesnt fit the tts.msft.say title … but then we are talking about google in it anyway!!)

Im trying to use the “new” action / tts.speak / node red with google homes and I can only get some “static” things working. and not my ideal.

The “end game” for me would be able to create node red action calls for messages from the flow to single and multiple google home / media player instances WITHOUT using specific IPs (cast node) or relying on HA scripts (with the message “canned” in the script … not ideal for variables in the flow passed to tts)

Its used to all work, but I changed homes and have only started setting it all back up.

Sooooo …

In HA developer mode this works

If I try this in node red the first attempt looks like this …

and if I run it I get this …

And I dont know how to set the media_player device … the “load example data” doesnt populate the media.player_entity_id …

I can manually add this … but I get the same error above

Any ideas that I can try …

Cheers All
Jamie

Text to speech is a two step process. The text to audio step uses the service (action) tts.speak with a target entity of the speech service. The second step uses a media player action with a target of the media device on which to play the audio.

tts.speak is a tts building block integration, and is used by adding a speech service integration to provide a full text to speech service. In such cases, the action would be something like ‘tts.google_translate_say’ and this action combines the tts.speak and the target text to speech service, thus the new action (speak using a tts service) only requires the media device entity-id as the target.

However, you can use the action ‘tts.speak’ on its own, but this then requires both the speech service and the media player. This is indicated by the help documentation requesting “media_player_entity_id” as a separate entry. These extra entries all go under the Data object.

With the update in HA to actions, the action still requires a target entity on which to perform the action, but in the Action Node the target entity has now moved from a distinct field in the UI down into the Data object. This is, as always, is called the ‘entity_id’. Yes, the documentation has not yet caught up with this change…

In HA Developer Tools, Actions, you have the target - ‘entity_id’ as “tts.google_translate_en_com” which is the target entity for speech. This, in the Node-RED action node, needs to go in the Data object under field “entity_id”.

Since you are using tts.speak, the media player (which is the output device) is not the target entity but rather an option entity, and this is now requested (for this action only) under “media_player_entity_id” and should be your media_player.dining_speaker

You will continue to get errors when attempting to call an Action if the options in the Data object are not correctly completed. Missing fields (entity_id), extra fields that are not expected (options) or incorrect values for fields will all generate errors.

For myself, the following is working under action ‘tts.speak’

{
   "media_player_entity_id": "media_player.kitchen_display",
   "entity_id": "tts.google_uk_co_uk",
   "message":"My name is hanna",
   "language":"fr"
}

I think you forgot to “uncheck” the “block input overrides” under the action/service node ?

Thanks both and sorry for the delay in reply.

@deepansteven
I read that the “Block input overrides” stops the current node from accepting changes to it config from an input. - What are your reasons behind saying it needs unchecking please?

@Biscuit
Thank you, you post / code snippet got me working, below is what I changed the JSON to in the node red action node and it now works. I mostly follow your explanation

{
   "media_player_entity_id": "media_player.dining_speaker",
   "entity_id": "tts.google_translate_en_com",
   "message":"The Roller Door Did Not Close Properly",
   "language":"ru"
}

I did uncheck “Block input overrides” at the same time, but unchecking that makes no difference. I can also swap to tts.google_uk_co_uk and that also makes no difference.

But if I go back, create a new action node, set the action to tts.speak and click load example data it errors as above (as you say the update is rolling out).

Thanks for all your help.

Now I just need to make it set the volume to a level and then set the old volume back after the announcement!

Jamie