Can I use SSML in a Rule "Speak a Message"

Using EchoSpeaks app, I can get messages to the specified echo in a rule. Works great!

I like to use a different voice when echo speaks from my code versus the cloud. Can I use SSML in a rule?

I tried:

<voice name="Matthew">Hello World!</voice>

but the first SSML fragment disappears when I click something.

Thatā€™s generally just a display issue, the tag should still be there just not visible.

But it doesn't work.

The specified echo "speaks" the message--twice, but in the default voice.

Looks like there is a built in feature for thisā€¦

Hmm, not in the version I installed a few days ago.

I'll have to check out the version number

Well, in actions, there's something that might be a "speech designer", but it doesn't include a voice option or a way to code SSML.

Someone mentioned you need <speak></speak> tags. Don't know if that was in the context of Rules, but I"ll give that a try.

Itā€™s buried a few levels downā€¦

Feeling stupid, I can't find it under:

Send, Speak or Log a Message, Send HTTP Request

Then under which action:

Send or Speak a Message

Iā€™m inside Echo Speaks, looks like youā€™re in RM

2 Likes

I found something similar, a "Response Designer" for (Switch) Trigger Events.

So, it can be done in the EchoSpeaks app, but not in a rule?

Does that mean the trigger for the Rule cannot be the same as the trigger event specified in the EchoSpeaks app? Otherwise, how would I know which runs first, or whether they try to run at same time?

Also, seems the speech designer is available for an "announcement" but not under speaks.

Not sure I know the difference between speak and announcement. From the Alexa app, an announcement has a preceding chime, but I didn't hear that when I tested the action in the Hubitat EchoSpeaks app.

More to learn.... (a good thing!)

My apologies I got sidetracked when you said Response Designer -> I immediately went to Echo Speaks and Speech Designer. Trigger for the rule and ES Action could be the same, but then theyā€™ll attempt to fire at the same instant. Could have the rule set a momentry switch or some other trigger for ES if you want to control when it speaks.

Havenā€™t tried it, but it occurs to me that you may be able to put the SSML in a variable and then speak the variable frm the ruleā€¦

1 Like

I'll try making the variable.

I think I read another thread that implied you couldn't use SSML in a rule. Haven't been able to dig it back up, though.

Seems like the same thing happens when I define a variable in the Rules machine.

When the variable text includes SSML, they seem to just get deleted when I save the variable.

When I use the variable in an speech action, the text (excluding the SSML) gets spoken, but the tags aren't used.

For example, the entry box for the (local) variable looks like this:

<voice name="Matthew">Hello</voice>

The name of the variable is Matthew.

The UI then displays the variable value as "Hello" (no SSML shown).

When the rule action,

Speak on Echo - Family: '%Matthew%

I just hear "Hello", in the default voice.

I did get the Matthew voice in the EchoSpeaks app to work.

Same, if I also enclose with

<speak> </speak>

tags--they seem to get deleted when the variable is saved

So, I did it in the EchoSpeaks app.

I didn't try to synchronize the speech with actions in the Rule. I don't care exactly when the speech occurs, as long as they don't somehow collide.

I had to add delays between rule actions to get them to run reliably. The rule actions issue http requests and run custom methods that issue http requests. They didn't work reliably until I added delay actions. Here, (as a delay action) the minimum delay is 1 second--much longer than I need, but it's ok.

I doesn't seem to hurt anything (yet) to let the speech action from the EchoSpeaks runs in "parallel" with the Rules actions.

1 Like

Thanks so much for the help on this!

I really like having one voice for the "OK", which says Alexa recognized the utterance.

Having another voice that includes what was done in the action makes it easier to debug when things go wrong. Alexa misunderstood? Something in my backend failed?

Anyway, works great now.

1 Like