Amazon Echo Control - Start Routine error while ThingHandler.handleCommand()

Hi openhab community,

after years of reading in this community and finding tons of useful information here, i now came to the point of needing to ask for help myself. I hope we can find a solution for my problem together.

I added a Amazon Echo Show to my openhab setup, to use it as a smart music alarm clock. Setup was quite easy, except for one thing. To set the alarm times dynamically, I wanted to send a command (with the same promt as when you use the voice input) to the echo. Sadly this doesn’t work, I get the following error in the log:

2022-01-25 19:24:45.927 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.smarthomej.binding.amazonechocontrol.internal.handler.EchoHandler@88b69c': null

java.lang.NullPointerException: null
	at java.util.Objects.requireNonNull(Objects.java:221) ~[?:?]
	at org.smarthomej.binding.amazonechocontrol.internal.connection.Connection.parseJson(Connection.java:770) ~[?:?]
	at org.smarthomej.binding.amazonechocontrol.internal.connection.Connection.getRoutines(Connection.java:1674) ~[?:?]
	at org.smarthomej.binding.amazonechocontrol.internal.connection.Connection.startRoutine(Connection.java:1616) ~[?:?]
	at org.smarthomej.binding.amazonechocontrol.internal.handler.EchoHandler.handleCommand(EchoHandler.java:641) ~[?:?]
	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.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [bundleFile:?]
	at com.sun.proxy.$Proxy1441.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:829) [?:?]

I’m running Openhab 3.2.0, Amazon API is amazon.de, every other Items work as expected. I tried the Echo Control Plugin included in 3.2.0, and also Version 3.2.10 from here (which fixes the Websocket Bug, but not my issue).

Below you can find the item/thing config and the jython rule I used to test, but its nothing too extraordinary I guess. Thanks in advance for your help!

Regards

Item

String Echo_Wecker_StartRoutine          "Start Routine"                         (gEcho_Wecker) {channel="amazonechocontrol:echoshow:xxxxx:echo_wecker:startRoutine"}

Thing

Bridge amazonechocontrol:account:xxxxx "Amazon Account XXXXX" [discoverSmartHome=0, pollingIntervalSmartHomeAlexa=30, pollingIntervalSmartSkills=120]
{
    Thing echoshow    echo_wecker      "Echo Wecker" @ "Schlafzimmer" [serialNumber="GXXXXXXXXXXXXX"]
}
@rule("Morning: Echo Wecker Test")
@when("Item test_switch changed to ON")
def echowecker_alarm(event):
    events.sendCommand("Echo_Wecker_StartRoutine", "wie wird das wetter") #How's the weather

That’s because you selected the wrong channel. Try textCommand instead of startRoutine.

1 Like

Oh. You won’t believe how much time I wasted finding the error. I should have tried the mirror, I guess :smiley:
Thanks. It works perfectly fine.

1 Like

Oh, and thanks for the bug report, I’ll fix the NPE. :slight_smile:

1 Like