Amazon Echo Control – LastVoiceCommand not receiving updates

Evening all,

I recently purchased a full complement of SONOS Ones for a few rooms of the house and have been integrating them with my openHAB setup. All has gone smoothly except for getting amazon echo control to work the way I want using the amazonechocontrol binding.

Everything seems to work fine apart from the all-important item: “lastVoiceCommand”. All other items work as expected, but this never gets updated (i.e. it should receive an update with the last voice command as text). My plan is to use the lastVoiceCommand to do all kinds of automation, but I’m utterly stuck!

Here’s my alexa_things file:

Bridge amazonechocontrol:account:alex "Amazon Account" @ "Accounts" [amazonSite="amazon.co.uk", email="[my email]", password="[my password]", pollingIntervalInSeconds=60]
{
	Thing	echo	alexa_ba	"Bathroom Alexa" @ "Bathroom" [serialNumber="30c22c7713dc4470850ad81f7c3831d8"]
	Thing	echo	alexa_b		"Bedroom Alexa" @ "Bedroom" [serialNumber="557ebe8b97864f6583ff9d52fe76af26"]
	Thing	echo	alexa_d		"Dining Room Alexa" @ "Dining Room" [serialNumber="0adc77c2fc7d42dcbd0002a344daad5f"]
	Thing	echo	alexa_g		"Garden Alexa" @ "Garden" [serialNumber="aa64a92a876a45d283a35fe5fdfa546a"]
	Thing	echo	alexa_k		"Kitchen Alexa" @ "Kitchen" [serialNumber="fcbd5049f5964e738b99efc58fd4441c"]
	Thing	echo	alexa_l		"Lounge Alexa" @ "Lounge" [serialNumber="eea44d0b363c41fea81f5ca8f537977f"]
	Thing	echo	alexa_lc	"Lounge (c) Alexa" @ "Lounge (c)" [serialNumber="5cabd21791a0467298eacfdb230e114b"]
	Thing	echo	alexa_i		"Alexa iPhone" @ "Mobile" [serialNumber="2d38b4d5fd0e49bab576778d460349b6"]
}

And here is the alexa_items file (the full file contains the same for 6 devices/rooms):

Group alexa_ba <player>

String alexa_ba_PlayMusicCommand	"Play music voice command (Write Only)" (alexa_ba) {channel="amazonechocontrol:echo:alex:alexa_ba:playMusicVoiceCommand"}
String alexa_ba_StartCommand		"Start Information" 					(alexa_ba) {channel="amazonechocontrol:echo:alex:alexa_ba:startCommand"}

// Commands
String alexa_ba_TTS					"Text to Speech"		(alexa_ba) {channel="amazonechocontrol:echo:alex:alexa_ba:textToSpeech"}
Dimmer alexa_ba_TTS_Volume			"Text to Speech Volume"	(alexa_ba) {channel="amazonechocontrol:echo:alex:alexa_ba:textToSpeechVolume"}
String alexa_ba_PlayAlarmSound		"Play Alarm Sound"		(alexa_ba) {channel="amazonechocontrol:echo:alex:alexa_ba:playAlarmSound"}
String alexa_ba_StartRoutine		"Start Routine"			(alexa_ba) {channel="amazonechocontrol:echo:alex:alexa_ba:startRoutine"}
Dimmer alexa_ba_NotificationVolume	"Notification volume"	(alexa_ba) {channel="amazonechocontrol:echo:alex:alexa_ba:notificationVolume"}

// Feedback
String alexa_ba_LastVoiceCommand	"Last command [%s]"	(alexa_ba) {channel="amazonechocontrol:echo:alex:alexa_ba:lastVoiceCommand"}

As explained above, all other items given here receive updates and can be controlled as expected – I’ve tried many others and they all work great.

I am running openHAB on Windows 10 with stable version 2.4.0 (although I have tested this on the latest 2.5.0 stable and snapshot builds. I have also tried the latest beta version of the amazonechocontrol bindning (amazonechocontrol_2.5.0.Beta_9_Preview_1). Same behaviour.

If anyone has experience this, please let me know if there is a way to get this working.

Thanks,
Alex

1 Like

I’m using the lastVoiceCommand channel with a snapshot a little newer than the milestone build and it works fine:

String Alexa_WZ_LastVoiceCommand {channel="amazonechocontrol:echo:account1:yxyxyxyxyxyxyxyx:lastVoiceCommand"}

I’m not familiar with manual things files (too much work), the autodiscovered channel for the lastVoiceCommand works fine.

Hi Sihui,

Thanks for the tip. First thing I did was to clear out my manual files and attempt autodiscovery. Unfortunately, it only discovered the flashbriefing thing. However, I didn’t really investigate this angle for long before something dawned on me.

I restored the manual .things approach and checked the Alexa echo control dashboard, and realised that it shows two Alexa endpoints for each of my Sonos One Speakers; one is helpfully labelled with the room (i.e “Lounge”) and the other is harder to discern (i.e “Alex’s 2nd Sonos One”). I was using the former. After creating dummy things and items for the the latter, I spoke a few commands in each room and worked out which devices belonged to which . Now all Alexa items are reporting correctly.

Problem solved! Thanks again for you help.

As a secondary point, my end goal is to intercept Alexa commands and do whatever using rules. I did a quick test and I can certainly get custom outcomes I want form non-standard commands. However, Alexa naturally still responds to that command verbally first.

In my test example, a rule triggers when lastcommand contains the words “one two three” and sends a command to the TTS item to respond with the word “four”. In practice, what happens is:

Voice command: “Alexa, one two three”

Alexa: “I don’t know that one” “four”

My question is whether the default response can be suppressed in some way. If so, I can see this being an extremely powerful tool.

Please try

Voice command: “one two three”

Works for me.

This seems to suggest that the command can be used without using a wake word. I haven’t found a way to set my devices up so they don’t need a wake word, so saying the command “one two three” will not be registered at all.

To be clear, thanks to your advice, lastVoiceCommand is now working perfectly. I now want to suppress the default response so that I can fully control what is reported back for the commands I specify in rules.

Here’s another test example, where the rule looks for the string “abc” and returns “d” via TTS.
This is the rule:

rule "Alexa Test 2"
when
	Item alexa_g_LastVoiceCommand received update
then
	if (alexa_g_LastVoiceCommand.state.toString.contains("a b c")){
	alexa_g_TTS.sendCommand("d")
	}
end

And in practice:

Voice command: “a. b. c.”
Alexa's response: "I think you want to play the song ABC, is that right?" "D"

As you can see, Alexa carries out the default response and then returns the outcome of the rule. My question is, can the default response be suppressed?

Hope that makes sense. And thanks again for your time.

Correct.

Sorry, I missed to tell you one step of my setup: you need to create a “Routine” in your Alexa app to get rid of the wake up word,

Yes, with a routine it should work that way. At least it does with my Alexa :grinning:

1 Like

I’ll give it a go. Thanks for your help!

If you send the voice command like this Alexa will just speak whatever is after “Simon says”

E.g “Simon says hello world”

Alexa will just say “Hello World”