[SOLVED] Alexa Control Binding TTS Stuttering

I have the Alexa control binding installed and have two rules that make use of the tts.

The first rule turns my heating off if one of my main doors is open for 20 seconds or more. It gets Alexa to say “Heating turned off” or “Heating turned on” and works flawlessly.

The second rule if for my smoke and co alarms. On activation the lights all come on and two sirens sound. Alexa will then say “Emergency Fire Fire” or “Emergency Carbon Monoxide in the Boys room”

This rule woks but the Alexa tts stutters.

Here is the rule;

// Safety Alarm Rules

// Turn on lights and sirens when alarm is active

rule "gSafety Alarm Group Activated"
        Item    gSafetyAlarms changed to ON
then    gLights_HandL.sendCommand(ON)
        sendNotification("xxxxx@gmail.com", "Fire or CO Alarm Active")

// Turn OFF sirens when alarm no longer active
rule "Silence Sirens"
        Item    gSafetyAlarms changed to OFF
then    gSafetySiren.sendCommand(OFF)

// Echo Announce Emergency
rule "Have Echo announce CO Alarm"
        Item gCOAlarms changed to ON
        Echo_Bedroom_TTS.sendCommand('Carbon Monoxide Alarm')
        Echo_Boys_Room_TTS.sendCommand('Carbon Monoxide Alarm')
        Echo_Living_Room_TTS.sendCommand('Carbon Monoxide Alarm')

rule "Have Echo announce Fire Alarm"
        Item gFireAlarms changed to ON

        Echo_Bedroom_TTS.sendCommand('Emergency Fire Fire')
        Echo_Boys_Room_TTS.sendCommand('Emergency Fire Fire')
        Echo_Living_Room_TTS.sendCommand('Emergency Fire Fire')

I get the following in the log;

2018-12-11 18:52:40.002 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@1335498': POST url 'https://alexa.amazon.co.uk/api/behaviors/preview' failed: Bad Request

org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.co.uk/api/behaviors/preview' failed: Bad Request

	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:513) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceNode(Connection.java:1029) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.Connection.executeSequenceCommand(Connection.java:1014) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.Connection.textToSpeech(Connection.java:1005) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.startTextToSpeech(EchoHandler.java:651) ~[?:?]

	at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.handleCommand(EchoHandler.java:528) ~[?:?]

	at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:]

	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [102:org.eclipse.smarthome.core:]

	at com.sun.proxy.$Proxy146.handleCommand(Unknown Source) [191:org.openhab.binding.amazonechocontrol:]

	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [109:org.eclipse.smarthome.core.thing:]

	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [109:org.eclipse.smarthome.core.thing:]

Any ideas?

If you only send one echo a TTS command does she still stutter? If so, you may need a short timer between each TTS, as three simultaneous commands may be to much, but that’s just a guess.:wink:

Thanks for the reply. Yes when testing I only had one echo enabled.

Can you post that one, please?

Here you go.

var Timer timer = null

rule "gMainDoors CLOSED"
    Item gMainDoors changed to CLOSED
    if(timer !== null) {
        timer = null}
    if(NestTStat_away_mode.state == "HOME") return;
    Echo_Living_Room_TTS.sendCommand('Heating turned on')

rule "gMainDoors OPEN"
    Item gMainDoors changed to OPEN
    if(timer === null) {
        timer = createTimer(now.plusSeconds(20)) [|
            Echo_Living_Room_TTS.sendCommand('Heating turned off')
            timer = null]}

Have you tried putting the TTS items in a group?
And just in case, change the single quotes ' to double quotes for the String "

Group String gAlexaTTS

Put the 3 TTS items in that group and change the rule to:

rule "Have Echo announce CO Alarm"
    Item gCOAlarms changed to ON
    gAlexaTTS.sendCommand("Carbon Monoxide Alarm")

Thanks - I’ll give that a try even if it doesn’t help it wil improve my code.

I put the Echo’s into a group and tried it. It still stutters with “Emergency Fire Fire”

It doesn’t stutter with “Carbon Monoxide Alarm” or when I tried “Roses are red. Violets are blue”

So there is something weird about “Emergency Fire Fire”

Maybe try another sentence:
“Emergency Fire Emergency Fire”

Or try adding punctuation

“Emergency! Fire! Fire!” or “Emergency, Fire, Fire”

I’ve changed the sentence but my wife has gone out so I’ll need to wait until I get home from work to know if it’s worked.

I changed it to “Fire Detected! Emergency! Fire! Fire! Fire!” and it no longer stutters.

Many thanks for your help.