Can turn Alexa on but not off via openhab

Hey everyone,

since some days I’m facing a very strange issue. My Alexa in the bathroom plays music based on a rule and gets shut down via another rule. It works perfectly fine that Alexa plays music but it doesn’t turn off anymore.

Rules for turning on and off:

rule "Radio Badezimmer an"
when
	Item OG_Bad_Taster_Radio changed to ON
then
	OG_Bad_SpiegelLicht.sendCommand(ON)
	var Number vol = Echo_Bad_Volume.state as Number
    vol = 20
    Echo_Bad_Volume.sendCommand(vol)
	Echo_Bad_Textbefehl.sendCommand('spiele 1 live auf TuneIn')
	OG_Bad_Taster_Radio.sendCommand(OFF)
end

rule "Radio Badezimmer aus"
when
	Item OG_Bad_SpiegelLicht changed to OFF
then
	Echo_Bad_Player.sendCommand(PAUSE)
end

The strange thing is what log says about this:

2022-09-08 21:04:28.074 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Echo_Bad_Musikanbieter' changed from  to TUNEIN

==> /var/log/openhab/openhab.log <==

2022-09-08 21:04:33.370 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler@e7d5b0': POST url 'https://alexa.amazon.de/api/np/command?deviceSerialNumber=G091JJ14209403CV&deviceType=A2H4LV5GIZ1JFT' failed: Internal Server Error

org.openhab.binding.amazonechocontrol.internal.HttpException: POST url 'https://alexa.amazon.de/api/np/command?deviceSerialNumber=xxxxxxxxxxxxxxx&deviceType=xxxxxxxxxxx' failed: Internal Server Error

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

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

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

	at jdk.internal.reflect.GeneratedMethodAccessor143.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.$Proxy29118.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.GeneratedMethodAccessor226.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.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) [?:?]

==> /var/log/openhab/events.log <==

2022-09-08 21:04:33.212 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'OG_Bad_SpiegelLicht' changed from ON to OFF

2022-09-08 21:04:33.242 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'gLight' changed from ON to OFF through OG_Bad_SpiegelLicht

2022-09-08 21:04:33.245 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Echo_Bad_Player' received command PAUSE

The rule never says to switch Echo_Bad_Musikanbieter to TUNEIN but as the text string says to use tunein I guys it’s just updated the item as it is using the musicprovider. After that logs give an internal server error for that echo. I checked the serialnumber it’s in fact the echo in the bathroom.
And after this happend the command for turning it of gets send but Alexa doesn’t stop playing music.

So looks like everything is fine while being off but changing the musicplayer results in this? Or maybe something completly different. Perhaps someone of you has an idea?

I see same issue, that I cannot send PAUSE command to stop music anymore, but had no time so far to look into this and don’t know if I have similar log entries. Maybe I find some time tomorrow to check the log

I have checked my system (OH3.2 and SmartHome/J Amazon Echo Control Binding v3.2.14) with the following results:

If I play/pause music per controling the echo with my voice, the status is correctly visible within openhab.
If I play/pause music via openhab, the command is not issued to the echo.

==> /var/log/openhab/openhab.log <==
2022-09-09 08:47:11.634 [INFO ] [control.internal.handler.EchoHandler] - Failed to handle command 'PAUSE' to 'amazonechocontrol:echo:d03d405215:G091AA0704523ARA:player'
==> /var/log/openhab/events.log <==
2022-09-09 08:47:11.525 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'EGKucheEchoDot_Musikwiedergabe' received command PAUSE
2022-09-09 08:47:11.530 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'EGKucheEchoDot_Musikwiedergabe' predicted to become PAUSE
2022-09-09 08:47:11.534 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'EGKucheEchoDot_Musikwiedergabe' changed from PLAY to PAUSE

(even the item changed from PLAY to PAUSE the music on the echo is still playing)

It seems that all /api/np endpoints are currently broken and at least on iOS it seems the associated functionality has also been removed from the App. We are working on that.

Hi @J-N-K,

Thanks for having a look and working on this.
Is the alarm sound issue I have maybe related, as maybe the same endpoint of affected?

No, that’s a different endpoint. But I have the impression that Amazon cleans up their (unofficial) API and we’ll probably run into more issues in the future.

Same issue here…
getting

2022-09-10 11:48:06.662 [INFO ] [control.internal.handler.EchoHandler] - getPlayer fails
org.openhab.binding.amazonechocontrol.internal.HttpException: GET url 'https://alexa.amazon.de/api/np/player?deviceSerialNumber=G090L911746706AE&deviceType=A3S5BH2HU6VAYF&screenWidth=1440' failed: Internal Server Error
        at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequest(Connection.java:691) ~[bundleFile:?]
        at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequestAndReturnString(Connection.java:555) ~[bundleFile:?]
        at org.openhab.binding.amazonechocontrol.internal.Connection.makeRequestAndReturnString(Connection.java:550) ~[bundleFile:?]
        at org.openhab.binding.amazonechocontrol.internal.Connection.getPlayer(Connection.java:1107) ~[bundleFile:?]
        at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.updateState(EchoHandler.java:851) [bundleFile:?]
        at org.openhab.binding.amazonechocontrol.internal.handler.EchoHandler.handlePushCommand(EchoHandler.java:1271) [bundleFile:?]
        at org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler.handlePushDeviceCommand(AccountHandler.java:756) [bundleFile:?]
        at org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler.handleWebsocketCommand(AccountHandler.java:745) [bundleFile:?]
        at org.openhab.binding.amazonechocontrol.internal.handler.AccountHandler.webSocketCommandReceived(AccountHandler.java:710) [bundleFile:?]
        at org.openhab.binding.amazonechocontrol.internal.WebSocketConnection$AmazonEchoControlWebSocket.onWebSocketBinary(WebSocketConnection.java:409) [bundleFile:?]
        at jdk.internal.reflect.GeneratedMethodAccessor171.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.call(CallableMethod.java:70) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.events.annotated.OptionalSessionCallableMethod.call(OptionalSessionCallableMethod.java:72) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.events.JettyAnnotatedEventDriver.onBinaryMessage(JettyAnnotatedEventDriver.java:143) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.message.SimpleBinaryMessage.messageComplete(SimpleBinaryMessage.java:75) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.appendMessage(AbstractEventDriver.java:67) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.events.JettyAnnotatedEventDriver.onBinaryFrame(JettyAnnotatedEventDriver.java:130) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.incomingFrame(AbstractEventDriver.java:147) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.WebSocketSession.incomingFrame(WebSocketSession.java:326) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.extensions.ExtensionStack.incomingFrame(ExtensionStack.java:202) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.Parser.notifyFrame(Parser.java:225) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.Parser.parseSingleFrame(Parser.java:259) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:459) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:440) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [bundleFile:9.4.46.v20220331]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [bundleFile:9.4.46.v20220331]
        at java.lang.Thread.run(Thread.java:834) [?:?]

What does this mean? Will the alexa integration in openhab not be supported anymore in the future?

There are two integrations:

  • openHAB Alexa skill: this is used to control openHAB from Alexa (e.g. „Alexa, turn on kitchen light“). This one uses an official Amazon API and will in the foreseeable future not be affected or can easily be adapted.
  • amazonechocontrol binding:This is used to control Alexa devices (e.g Echos or Alexa connected SmartHome devices) from openHAB. This uses the same API as the Alexa app (it mimics openHAB to look like an app installed in an iPhone). The API used is not public and was so it depends if we can figure out how the app does things.

This would be very frustrating for me. I have build a lot of my routines on this communication. I have a lot of rules were Alexa does something based on an action in the house. For example if I have homeoffice and turn on my pc in the office alexa starts playing music. Of course I could say it to here but thats not “smart”. And I use text to speech very very very often. For example to announce that a 3d print or the washing machine is ready.

So if the API stops working a lot of my routines don’t work anymore.
Besides pausing the music it looks like everything is still working. Is there maybe any work around for now?
For example I start the music with this comman:

Echo_Bad_Textbefehl.sendCommand('spiele 1 live auf TuneIn')

Shouldn’t it stop the music to use the same command like this:

Echo_Bad_Textbefehl.sendCommand('ausschalten')

?

Probably. I didn’t check if “ausschalten” works. I usually say “Alexa, aus”, and that turns off any music or alarm.

I’m back home and checked my approach. And it’s a workaround.

I have reset my echo dot to a change on the wifi setup.

Not sure if that’s related to the reset at all or if Amazon fixed the api, but the play/pause is working for me again

I just got some reports that it automatically fixed itself for others.

I just use a text command that says Stop Music. It has not failed.
image

1 Like