[SOLVED] Get Alexa to speak a variable text


I am trying to get Alexa to speak out a variable text but I am stuck.

I have setup everything and can get alexa to speak a command written in the “command” field of the rules section in Update action.
However I cannot find in the documentation what to put in the command field to speak out the variable text from an item. The item is called “Alexa_Speak_Office_Var” and is updated via node red.


I have tried a speak.rules file (below) but does not work.

var speak = Alexa_Speak_Office_Var

rule “speak var text to Alexa”

 		Item Alexa_Speak_Office_Var received update

	Echo Office_Speak.sendcommand(speak)


Does anyone have any ideas where I can find the info to do this?

Thanks in advance

Have you added the TTS channel and is it linked to the correct item?

Use the correct item, Echo Office_Speak should not have a space between Echo and Office. See the correction in the rule below and make sure that your item is named correctly as well.

Try this modified rule, after changing the item, to check if alexa will speak.

Example Item:
You will need to change the channel to match yours

String Echo_Office_Speak      "Text to Speech"       (Alexa) {channel="amazonechocontrol:account:account1:Echo_Plus:textToSpeech"}

Modified rule:

rule "speak var text to Alexa"

 		Item Alexa_Speak_Office_Var received update

        Echo_Office_Speak.sendCommand("Alexa should say whatever is typed here, like speak")


1 Like

Hi H102

Thanks for the reply.

I got confused about the “echo” text, thought it was used for executing to command line :thinking: as my item is called “Office_Speak” without the echo bit.

I have been playing around and got it working now.
I was going about it all wrong, assuming I had to convert a variable string into text from within a rule in OH when all I needed to do was send a string msg.payload to Office_Speak (speak item linked to the echo) in node red and it reads it out no problem.

Thanks again for your help. :-):grinning:

1 Like

Glad you got it working.:+1:

Please mark the post solved by clicking the square box on the post that provided the solution and edit the title to start with [Solved].