Problem Running Alexa Routines from Amazon Control Binding

Hi everyone,

I’m having intermittent problems with OpenHab rules that run Amazon Alexa routines using StartRoutine.

At present I have a couple of time triggers which start an Alexa routine to pull the bedroom blinds halfway down at 3pm when the sun blasts in, and then all the way down at sunset.

These have been working perfectly until a few weeks ago. Now they work on occasions, but mostly don’t.

Details of the environment that may be relevant are:
OpenHAB 2.5.7-1 (Release Build)
Amazon Control Binding 2.5.7
Raspbian GNU/Linux 10 (buster)
Kernel Linux 5.4.51-v71+
Raspberry Pi 4 Model B Rev1.1
OpenJDK Runtime Environment Zulu 8.48.1.243

Below is the relevant section from the Openhab log.

I’ve found a few posts about issues with the Amazon Control binding, but I think they’re mostly related to text to speech functions so I’m not sure if it’s the same base problem or not. I’m also not sure if this is even an Openhab problem or possibly something on the Amazon side of things beyond our control.

Very grateful for any suggestions towards fixing this.

Cheers,
Pete.

2020-08-16 15:00:00.016 [INFO ] [g.eclipse.smarthome.model.script.PAL] - Afternoon Shades Half Down Triggered
2020-08-16 15:00:01.559 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@1520e65': GET url 'https://alexa.amazon.com/api/behaviors/automations?limit=2000' failed: Too Many Requests
org.openhab.binding.amazonechocontrol.internal.HttpException: GET url 'https://alexa.amazon.com/api/behaviors/automations?limit=2000' failed: Too Many Requests
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:646) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequestAndReturnString(Connection.java:502) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequestAndReturnString(Connection.java:497) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.getRoutines(Connection.java:1459) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.Connection.startRoutine(Connection.java:1392) ~[?:?]
	at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.handleCommand(EchoHandler.java:644) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_262]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_262]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_262]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_262]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
	at com.sun.proxy.$Proxy288.handleCommand(Unknown Source) [?:?]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:74) [bundleFile:?]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [bundleFile:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_262]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_262]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_262]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_262]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [bundleFile:?]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_262]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_262]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_262]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]

The log mentions too many request so try and change the rule to have so each blind is not sent a command at the exact time. If you need help with this please post the rule and someone will be glad to assist.

Hi, and thanks for responding.

The crazy thing is the routine is only being called once for any given operation. There are five blinds, each with their own RF channel, but they are also bound to a group channel which makes them all operate at once. They are driven by an Orvibo RF hub, which in turn is controlled by an Alexa skill.

So at 3pm the following rule runs:

var command3 = "Shades Down"

//1500 Shades Half Down
rule "Afternoon Shades Half Down"
when
	Time cron "0 0 15 ? * *"
then
	logInfo("PAL", "Afternoon Shades Half Down Triggered")
	AmazonEchoStudio_StartARoutine.sendCommand(command3)
end

The “Shades Down” command maps to an Alexa routine which contains a single Orvibo command “Blinds Off” which triggers the shared RF channel. The blinds should then simultaneously go half way down as there is an intermediate stop point programmed into their motors.

That is the only time that OpenHAB calls that routine until sunset, when an Astro trigger runs a similar rule which lowers the blinds fully.

So I don’t understand the “too many requests” error, and as I mentioned these rules used to operate flawlessly.

Cheers,
Pete.

Try restarting the binding via the console or restarting (not rebooting) OH.

To restart OH use sudo systemctl restart openhab2 to restart the binding see the doc’s for how to use the console.

Thanks for the suggestion. The OpenHAB restart didn’t achieve anything, but for a while I thought the binding restart may have solved it.

Unfortunately after a few successful operations it failed again. It’s currently working about one time out of every three or four attempts. I don’t understand this - would have thought it would either work all the time or not at all.

I implemented this a couple of days ago and it worked perfectly for about 24 hours then I started getting the same errors. I have an Alexa routine setup to notify my phone when a gate is opened.

This is my rule.

triggers:

  • id: “1”
    configuration:
    itemName: openHABserver_ItemBackGateDummy
    state: OPEN
    previousState: CLOSED
    type: core.ItemStateChangeTrigger
    conditions: []
    actions:
  • inputs: {}
    id: “2”
    configuration:
    itemName: Workshop_StartaRoutine
    command: back gate is open
    type: core.ItemCommandAction

This is the error.

2021-01-28 12:51:36.081 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@dbec7f’: GET url ‘https://alexa.amazon.com/api/behaviors/automations?limit=2000’ failed: Not Found

org.openhab.binding.amazonechocontrol.internal.HttpException: GET url ‘https://alexa.amazon.com/api/behaviors/automations?limit=2000’ failed: Not Found

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

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

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

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

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

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

at jdk.internal.reflect.GeneratedMethodAccessor123.invoke(Unknown Source) ~[?:?]

at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]

at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]

at org.openhab.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]

at com.sun.proxy.$Proxy860.handleCommand(Unknown Source) [?:?]

at org.openhab.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:80) [bundleFile:?]

at org.openhab.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:48) [bundleFile:?]

at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]

at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]

at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

at java.lang.Thread.run(Thread.java:834) [?:?]

I think I will also submit this to Amazon and see if they have any idea what has happened. It is almost like they changed the link.
Thank you

see Limit=2000' failed: Not Found

1 Like

This worked for me. Back up and running.

update org.openhab.binding.amazonechocontrol https://janessa.me/esh/org.openhab.binding.amazonechocontrol-3.1.0-SNAPSHOT.jar

Thank you

1 Like

I have the same problem here - unfortunately @Rbartlett solution didn’t work for me.

Are there any other solutions?

My solution was for OH3. What version are you on?

Link in post 7 points to solution for 3.0 and 2.5.

Sorry - I forgot to mention it. I’m on OH3 (3.0.1). When I do the update, the things won’t work at all anymore. They are still shown in Paper UI, but all relevant things are shown as “Uninizialized”

Try disabling and enabling the account. You may also look at the device Things and make sure the account is selected.

I finally found out why it doesn’t work for me - the jar file is no longer available at the URL given above :wink:

I see it is now the standard binding. You may need to update your binding. 3.0.1

I have version 3.0.1 of the binding. To make sure, I updated the complete system, but still the same error with the routines

https://janessa.me/esh/org.openhab.binding.amazonechocontrol-3.1.0-SNAPSHOT.jar is dead.