Amazon Echo SmartJ Binding Last Voice Command not working anymore

@Mat1: Great, that works! Thanks a lot. This way I could recover my old functionality.
I changed it to JavaScript and added the extraction of the Command. So if anybody is interested here is the code (see square brackets and comments to adjust to your needs). Let me know if things can be solved in a better way…

var lastCommand, serialNumber, echoName, echoMapping;
var HTTP = Java.type("org.openhab.core.model.script.actions.HTTP");
var url = "http://[yourIP]:8080/amazonechocontrol/[yourEchoBridgeName]/PROXY/api/activities?startTime=&size=1&offset=1";
var respJson = "" + HTTP.sendHttpGetRequest(url, 10000);

serialNumber = JSON.parse(respJson).activities[0].sourceDeviceIds[0].serialNumber
lastCommand  = JSON.parse(JSON.parse(respJson).activities[0].description).summary

// replace those with your Echo-IDs and Names. 
echoMapping = {'[serialOfEcho1]': '[NameOfEcho1]', '[serialOfEcho2]': '[NameOfEcho2]', '[serialOfEcho3]': '[NameOfEcho3]'};
echoName = String(echoMapping[serialNumber]) ;

// eliminate the alexa keyword
lastCommand = (lastCommand.toLowerCase()).replaceAll('alexa ','');

if (lastCommand == 'example command' || lastCommand == 'another command') {
...your code...

Please correct me if I’m not following the logic here. For now, we have a workaround (thanks @Mat1!) using a dummy routine and retrieving the last command via an API, but eventually this method in theory could be baked into the binding itself as the old method no longer works. Is that a possibility?

Also, does this workaround provide the device which received the command, as that’s crucial in my setup to do all sorts of things?

yes, that’s already included.

but you have to enter the mapping of serial-IDs and thing-names as the API only returns the ID

1 Like

That was too early for me to report, now it has stopped for me as well. Last recognized command was 2023-08-30 late evening.

My LastVoiceCommand died also yesterday. The “special” version of the binding doesn’t work for me. So I implemented the workaround. It’s really nice and much better than nothing.
While testing, I recognized, that there is a problem with more than one amazon account. Only the first account which goes online works like expected. When the second account thing is started, I get this log entries:

2023-09-04 21:17:32.388 [WARN ] [trol.internal.handler.AccountHandler] - Failed to create account servlet
java.lang.IllegalStateException: ServletModel{id=ServletModel-76,name='org.smarthomej.binding.amazonechocontrol.internal.AccountServlet',alias='/amazonechocontrol/account2',urlPatterns=[/amazonechocontrol/account2/*],servlet=org.smarthomej.binding.amazonechocontrol.internal.AccountServlet@1f3696b,contexts=[{HS,OCM-69,default,/}]} can't be registered. ServletContextModel{id=ServletContextModel-2,contextPath='/'} already contains servlet named org.smarthomej.binding.amazonechocontrol.internal.AccountServlet: ServletModel{id=ServletModel-74,name='org.smarthomej.binding.amazonechocontrol.internal.AccountServlet',alias='/amazonechocontrol/account1',urlPatterns=[/amazonechocontrol/account1/*],servlet=org.smarthomej.binding.amazonechocontrol.internal.AccountServlet@1921684,contexts=[{HS,OCM-69,default,/}]}
	at org.smarthomej.binding.amazonechocontrol.internal.AccountServlet.<init>( ~[?:?]
	at org.smarthomej.binding.amazonechocontrol.internal.handler.AccountHandler.initialize( ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke( ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke( ~[?:?]
	at java.lang.reflect.Method.invoke( ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect( ~[?:?]
	at ~[?:?]
	at ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker( ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$ ~[?:?]
	at ~[?:?]

I tested this with the original, the “normal” snapshot and the snapshot from this thread. Always the same behavior.
@J-N-K You may have a look at it, but it is very less important.

Austria. Mine has died too now. openHAB 3.4.0

I was using lastVoiceCommand in a rule for more reliable room aware voice commands. It did work very well.

That is exactly what I did too… Dummy Alexa routines that just say OK to suppress Alexa’s dumb responses with OH then handling the command. It worked very good or I should say did work very good. I have not upgraded to OH4 yet!

A short information about what‘s going on: we found that the activity is no longer reported via websockets but an HTTP/2 stream. We still have some issues with getting this stream initiated in the correct way, but it looks not so bad.

The ugly news is: openHAB 3.4 does not bundle Jetty support for HTTP/2, so it could be that the „solution“ will only work on OH4.


Is it possible to just upgrade Jetty within OH 3.4 to a newer version?

Best, Jay

I figured I’d be better off just by checking my Echo through a bash script and post the result in OpenHAB - so there’s no need for an Alexa routine to trigger the whole thing. The only disadvantage (yet) is that if the same command is given twice after the other it doesn’t do anything. I’ll think about that, but it was just a quick and dirty fix for my problem so that Alexa at least listens (even though it doesn’t even speak anymore triggered from OH).
If you named the last voice command variable differently in your OpenHAB then replace Alexa_LastVoiceCommand with that.

Just copy-paste it and save it as a bash file eg., make it executable.
Then you can start it inside a screen window so you can let it run in the background:
sudo screen -dmS alexa-checker /[your path]/

while a==0; do
	variable=$(curl 'http://localhost:8080/amazonechocontrol/[your echos name]/PROXY/api/activities?startTime=&size=1&offset=1')
	command=$(echo $variable | tr "," "\n" | tr '{' ' ' | tr "}" " " | grep "summary" | sed 's/.*:\\//g;s/\\//g;s/\"//g')
	echo "Command: $command"
	if [[ $command != $previouscommand && $previouscommand != "startroutine" ]]; then
		echo $(date +%Y-%m-%d_%H:%M:%S)
		curl -m 2 -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "$command" "https://[your OpenHAB IP]:[your OpenHAB port]/rest/items/Alexa_LastVoiceCommand" -k --user [your OpenHAB username]:[your OpenHAB password]
		if [[ $previouscommand == "startroutine" ]]; then
		sleep 10;


I know it’s far from a perfect solution but it works without the need to Alexa routines triggering anything on OpenHAB - until the guys much better in coding create a new binding for us. :slight_smile:


yes, that is a possibility, thank you!
For everybody failing to adapt this, the url is (at least for me) not “[your_echos_name]” but the account ID, that 10digit hexadecimal thing or how you have named your account.

1 Like

To me it’s literally the part which is blacked out.

1 Like

Hi @J-N-K
First of all thank you for your work.
Do you think we have to wait for a soon official fix of the addon that you propose ?
Or me must use the ‘rule fix’ previously described meanwhile ?

1 Like

I am lacking time to fix it at the moment. Essentially the websocket connection needs to be removed and a new HTTP/2 stream hast to be added. There might also be changes needed to the login process. Similar changes can be found in ioBroker, so if someone wants to try, I can assist but currently I don’t have time to fully do it myself.


Unfortunately i don’t have the skill to help you.
I have just a feature request for who will try to fix the bindign.
Using the workaround i just realized that i can also check what my smartwhatch do:
Checking in http://myip:8080/amazonechocontrol/AlexaAccount
i can read this:

Alexa Bagno	G**************M	Online	Alexa Bagno	ECHO	A************A	A************O
Enrico's Verona	7******************************d	Offline	Not defined	UNKNOWN	A************6	A************O

Enrico’s Verona is the alexa of my Amazfit Gtr3 smartwhatch. but is from family unknown and cant be added.
Sorry is more work but this is one of the best bindigns for openhab!

1 Like


I created the rule as indicated

but this is what I get back (see below). Did I make a mistake?
Thanks for your help.

2023-09-21 11:17:42.088 [INFO ] [re.model.script.Echo, serialNumber: ] - Amazon Echo Control

Amazon Echo Control

Amazon Account

“xxxxxxxxxx” is mi account id

1 Like


You can try to see what the source of the problem is. You could start by checking if you have access to:


you can replace “openhab:8080” by the ip where OH is running, for example in my case it is:

If you have multiple accounts, you may also have to change “account1” to the appropriate account.

When I put that address in a browser I get something like this:

{“activities”:[{“_disambiguationId”:null,“activityStatus”:“SUCCESS”,“creationTimestamp”:1695313282996,“description”:"{"summary":" play music","firstUtteranceId":"A1…

See Amazon Echo Control - Bindings | openHAB for more details on how to set up the “Amazon Echo Control Binding” if you have problems with the above.

On the other hand, for the rule to work you need to have the “JSONPath Transformation” installed in the OH additions.


Thanks, I didn’t enter the correct account. Everything works very well now.
Thank you again for this quick feedback

I am also looking for a solution, but the result I get from the api request is

Amazon Echo Control

Amazon Echo Control

B17 Bridge Amazon Konto

so therefore just showing a link to the amazon account. I also tried varieties of the “accountx” part but that also doesn’t help. I have just one amazon account (as far as I can remember).
Amazonechocontrol binding is version 3.4.5.
What did I miss? Thanks

EDIT: Solved. Replacing “account1” with the account ID did the trick.

Thanks for this workaround. 2 Questions:
Can someone help me finding out the json for the last command? For the moment my thing is like that, but I only want the summary.

stateTransformation ="JSONPATH:$.activities[0]description" ]

After a question to my echo I want an answer from this device I spoke. Is ist possible to generate a variable like.

    Item Alexaaahttpcall3  changed

    val neu = ""
    if (Alexaaahttp.state == "G091MK08210703DG") neu = AlexaShowKlein_Ankundigung
    sendCommand(neu, "Hallo")

Thx Joe