Released: Openhab2 Amazon Echo Control Binding (controlling alexa from openhab2)

Tags: #<Tag:0x00007fd30e5f2c90> #<Tag:0x00007fd30e5f2b50> #<Tag:0x00007fd30e5f2a10>

(Kim Skatun) #548

Great binding @michi !
I have 6 echo dot devices and I use them as an alarm clock, however I would like my heating to turn on 15 minutes before the alarms goes off, and also it would be nice to slowly increase light level before alarm goes off. The problem is that I can not figure out how to get the current alarm time. I can do things with IFTTT when the alarm goes off, but I would like do things before the alarms goes off! Is this possible to implement?

(Mark) #549

Hi Andrew,

I am interested in how did this. The more details the better for me as I am still learning. Thx

(Mark) #550

A question.

I am not sure if its an Echo limitation or the binding I am using. For shutter control it seems I have only two options, either 0% or 100%. Stop, open, close , up, down do not work. Where is the limitation? I am using the BTicino BUS binding by Massimo.

(Andrew Pawelski) #551

Heres my full rule for my calendar reminder:

rule "Calendar Reminder"
		 Time cron "0 0/1 * * * ?"   // every 1 minute
		if (Away_switch.state != ON) {
			val DateTime CheckTimeStart = new DateTime((CalendarTimeStart1.state as DateTimeType).getZonedDateTime.toInstant.toEpochMilli)
			val DateTime roundedeventstart = CheckTimeStart.minuteOfDay().roundFloorCopy
			val DateTime roundednow = now.minuteOfDay().roundFloorCopy			
			val reminderList = newArrayList("You have a calendar event, ", "You've got an event -  ", "Start thinking about the event -  ", "Next up in your Calendar is, ", "It's nearly time - ", "There is something in your Calendar, ", "Something's coming up - ")
			val rndNumber = (Math::floor((Math::random * 7) + 1).doubleValue).intValue
			val remindsound = newArrayList("ECHO:system_alerts_soothing_01", "ECHO:system_alerts_atonal_02", "ECHO:system_alerts_melodic_05", "ECHO:system_alerts_repetitive_04", "ECHO:system_alerts_melodic_03", "ECHO:system_alerts_melodic_06", "ECHO:system_alerts_repetitive_01","ECHO:system_alerts_melodic_07", "ECHO:system_alerts_soothing_05", "ECHO:system_alerts_atonal_03", "ECHO:system_alerts_rhythmic_02", "ECHO:system_alerts_musical_02", "ECHO:system_alerts_melodic_01", "ECHO:system_alerts_melodic_02", "ECHO:system_alerts_alarming_03")
			val rndremindNumber = (Math::floor((Math::random * 15) + 1).doubleValue).intValue
			val heylist = newArrayList("Y'all  ", "Everybody  ", "Friends  ", "People  ", "Peops  ", "Folks  ", "Humans  ", "Chums  ", "Pals  ", "Gang  ", "Crew  ", "Squad  ", "Pack  ", "Posse  ", "Colleagues  ", "Team  ", "Mates  ", "Companions  ", "Compatriots  ", "Associates  ", "Confidants  ", "Confederates  ", "Crowd  ", "Team Pawelski  ", "Plebs  ", "Band  ", "You Lot  ", "Mortals ", "Groovy Dogs ", "You crazy pack of drop bears ")
			val rndheyNumber = (Math::floor((Math::random * 30) + 1).doubleValue).intValue
			val remindsoundvalue = remindsound.get(rndremindNumber - 1).toString

			if (roundednow.plusMinutes(60) == roundedeventstart) {
				Alexa_Living_Room_Speak.sendCommand('Hey ' + heylist.get(rndheyNumber - 1).toString + ', ' + reminderList.get(rndNumber - 1).toString  + CalendarName1.state +  ' starting in 60 minutes')
			else if (roundednow.plusMinutes(30) == roundedeventstart) {
				Alexa_Living_Room_Speak.sendCommand('Hey ' + heylist.get(rndheyNumber - 1).toString + ', ' + reminderList.get(rndNumber - 1).toString  + CalendarName1.state +  ' starting in 30 minutes')

(Markus S.) #552

Hi to all.
Any news or ideas how i can solve the problem with undefinied state of volume.items?
Thanks and greetings,

(David B.) #553


that binding is an awesome idea. Thanks!

But I’ve got a problem. I’m not able to connect to my Amazon Account (.de). When I open /amazonechocontrol, I get an error 500 with the following message:

org.openhab.binding.amazonechocontrol.internal.ConnectionException: No session id received
	at org.openhab.binding.amazonechocontrol.internal.Connection.getLoginPage(
	at org.openhab.binding.amazonechocontrol.internal.AccountServlet.doGet(
	at javax.servlet.http.HttpServlet.service(
	at javax.servlet.http.HttpServlet.service(
	at org.eclipse.jetty.servlet.ServletHolder.handle(
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(
	at org.eclipse.jetty.servlet.ServletHandler.doScope(
	at org.eclipse.jetty.server.session.SessionHandler.doScope(
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
	at org.eclipse.jetty.server.Server.handle(
	at org.eclipse.jetty.server.HttpChannel.handle(
	at org.eclipse.jetty.server.HttpConnection.onFillable(
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
	at org.eclipse.jetty.util.thread.QueuedThreadPool$

Is there a known solution?

Thanks in advance


(SiHui) #554

Did you provide your credentials for your Amazon account?

(David B.) #555

Yes. I also double checked the credentials, they are correct.

When I start openHAB on a different Host (Windows Workstation), the binding works without any problems. The error only occurs on my openHAB server (based on Ubuntu). So I think there is no problem with my account or the credentials.

Has anybody a hint on how to troubleshoot the error? All other bindings are working fine on the ubuntu server.

Thanks and kind regards


(Marcus K.) #556

did you try to enter your crendentials using http://YOUR_OPENHAP/amazonechocontrol/ID_OF_THIS_THING i needed to do this on debian because otherwise it wouldn’t connect for me too

(Sebastian Zimmermann) #557


for me the same, than DavidB.
This link http://YOUR_OPENHAP/amazonechocontrol/ID_OF_THIS_THING doesn´t work, too.
But the thing wasn´t created. First with error 500. After a second try, with 409, conflict error.

I also tried a complete reboot. I guess, there is something wrong with this binding in combination with OH 2.3 RC1.


(David B.) #558


thanks for your reply. I can access this link, but I’m not able to enter any credentials. The error above (No session id received) is shown on that page.

In my openHAB log, there is an error regarding a plugin with the version 2.4.0.*:

2018-06-03 19:46:15.743 [ERROR] [rg.openhab.binding.amazonechocontrol] - FrameworkEvent ERROR - org.openhab.binding.amazonechocontrol
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.amazonechocontrol [266]
  Another singleton bundle selected: osgi.identity; type="osgi.bundle"; version:Version=""; osgi.identity="org.openhab.binding.amazonechocontrol"; singleton:="true"

I’m on openhab 2.3 stable. Any ideas, why 2.4 ist mentioned?



(Marcus K.) #559

just a guess, do you have the binding installed in your addon folder as well as using paperUI?

also did you already tried deleting the cache?

(Marcus K.) #560

is there a specific reason you are still running OH 2.3 RC1? if not updating to openHAB 2.3.0-1 (Release Build) might be worth a try

(David B.) #561

Yes, i put the file in the addon folder during troubleshooting. Not sure if the message started at that point.

But clearing the cache did the job! Now everything is working fine.

Thank you very much. You made my day! :slight_smile:

And thank you for the binding. I love it!



(Scott Rushworth) #562

I’m getting the same error. First time install of the binding on OH 2.4.0 snapshot 1293. Clearing the cache didn’t help. I had two factor authentication when I first set up the Account Thing, but I’ve deleted the Thing and removed two factor auth. Is there a cookie being used?

(Sebastian Zimmermann) #563

is there a specific reason you are still running OH 2.3 RC1? if not updating to openHAB 2.3.0-1 (Release Build) might be worth a try

There is no reason. This is the version, that was offered to me during apt-get update / upgrade.

sebzim@openHAB:~ $ apt-cache policy openhab2                                                                                                                                                                       
  Installed: 2.3.0.RC1-1                                                                                                                                                                                           
  Candidate: 2.3.0.RC1-1
  Version table:                                                                                                                                                                                                   
 *** 2.3.0.RC1-1 0                                                                                                                                                                                                 
    100 /var/lib/dpkg/status                                                                                                                                                                                   
 2.3.0-1 0                                                                                                                                                                                                     
    500 testing/main armhf Packages                                                                                                                                  
 2.3.0~RC2-1 0                                                                                                                                                                                                 
    500 testing/main armhf Packages                                                                                                                                  
 2.3.0~RC1-1 0                                                                                                                                                                                                 
    500 testing/main armhf Packages                                                                                                                                  
 2.2.0-1 0                                                                                                                                                                                                     
    500 testing/main armhf Packages                                                                                                                                  
 2.1.0-2 0                                                                                                                                                                                                     
    500 testing/main armhf Packages                                                                                                                                  
 2.0.0~RC1-1 0                                                                                                                                                                                                 
    500 testing/main armhf Packages  

Normally, the latest version should be installed during update / upgrade process, right?

(Sebastian Zimmermann) #564

Got it running. I had “downgrade” to OH 2.3.0-1
With my RC1 version, it was not running.

Thanks for help.

(Daniel Walters) #565

I’m currently using TFA on my Amazon account and would like to use this binding. Is it technically possible to use the API using a user created application token instead of username/password?


(SiHui) #566

Since this morning my Amazon Account Thing is offline:

Status: OFFLINE - CONFIGURATION_ERROR Login fails. Check your credentials and try to login with your webbrowser to http(s)://youropenhab:yourport/amazonechocontrol/echo1 Wichtige Mitteilung! Zum besseren Schutz Ihres Kontos geben Sie bitte nochmals Ihr Passwort ein, und geben Sie dann die Zeichen ein, die in der Abbildung unten gezeigt werden.

It seems Amazon is asking for something like a captcha, but where to call that captcha page?

http(s)://<youropenhab:yourport>/amazonechocontrol/echo1 does show:


but a click on “Amazon Account” does not load any page … same for

/amazonechocontrol/ and /amazonechocontrol/account

openHAB snapshot 2.4 #1292

(Michael Geramb) #567

Sorry, currently not.