Release Candidate and Support: Amazon Echo Control Binding

I’ve got this awesome binding giving me a 60 and 30 minute reminder of my caldav calendar and it works great however occasionally it does an alarm instead of a reminder anyone else found this? How can I help with troubleshooting this?

Hi Andrew,
maybe you can check the history of reminders in the AlexaApp. If there is a reminder at this time, then it must be a bug in the alexa SW.
Regards,
Michael

Maybe you have an rounding error problem. Try to replay the sendCommand of the second rule with updateState to prevent a loop by calling the first rule, triggered by the second:

rule "Scale Factor Wohnzimmer"
when
  Item Echo_Wohnzimmer_Volume_default received command
then
  var Number value = Echo_Wohnzimmer_Volume.state as DecimalType
  var Number value_def = Echo_Wohnzimmer_Volume_default.state as DecimalType
  if(value!=value_def*0.8){
  sendCommand(Echo_Wohnzimmer_Volume, value_def*0.8);
  }
end


rule "Scale Factor Wohnzimmer"
when
  Item Echo_Wohnzimmer_Volume changed
then
  var Number value = Echo_Wohnzimmer_Volume.state as DecimalType
  var Number value_def = Echo_Wohnzimmer_Volume_default.state as DecimalType
  if(value_def!=value/0.8){
   postUpdate(Echo_Wohnzimmer_Volume_default, value/0.8);
  }
end

All the reminders are there that I can see

Hello,

I would like to ask a few questions.

Is it possible to let Alexa remind me at a specific time on a specific day?

I am asking because I would like to use such a feature to let Alexa remind me at for example at 22:00 - 1 day before I need to put the trash cans/bins outside.

Yes, but you must do this with a rule which starts the remind function at the target time.

Does anyone has actual problems with the binding? Especially with the radio stations? (Getting an error within the log that the notification element couldnt been validated, posting it later, at work at the moment)

How can I use a calendar in rules? Sorry kinda new to the whole programming stuff

If you really want to use a calendar, look into Google Calendar Scheduler, CalDAV Personal, or CalDAV Command.

But the easier route would be to use a cron trigger. I still had this around from before I setup CalDAV…

rule "Cron: Time to take the trash out"
when
    Time cron "0 0 15 ? * MON"// every Monday at 3pm
then
    val String message = "Time to take the trash out"
    SMS_Notification.sendCommand(message)
    if (Presence.state.toString == "Home") {
        Audio_Notification.sendCommand(message)
    }
    logInfo("Rules", "Cron: {}",message)
end
1 Like

So here are the mentioned log entries, that are shown red and the beginning of the change of the tuneinradiostation:

2018-03-07 19:27:54.202 [vent.ItemStateChangedEvent] - EchoImSchlafzimmer_TuneInRadioStationsID changed from to 0

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

2018-03-07 19:27:59.511 [WARN ] [mazonechocontrol.internal.Connection] - Parsing json failed {}

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 5 column 1 path $

at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224) ~[?:?]

at com.google.gson.Gson.fromJson(Gson.java:887) ~[?:?]

at com.google.gson.Gson.fromJson(Gson.java:852) ~[?:?]

at com.google.gson.Gson.fromJson(Gson.java:801) ~[?:?]

at com.google.gson.Gson.fromJson(Gson.java:773) ~[?:?]

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

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

at org.openhab.binding.amazonechocontrol.handler.EchoHandler.updateState(EchoHandler.java:396) ~[?:?]

at org.openhab.binding.amazonechocontrol.handler.EchoHandler.lambda$0(EchoHandler.java:356) ~[?:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

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

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]

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

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

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

Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 5 column 1 path $

at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385) ~[?:?]

at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213) ~[?:?]

… 15 more

2018-03-07 19:27:59.540 [WARN ] [mazonechocontrol.internal.Connection] -

(function(d,e){function h(f,b){if(!(a.ec>a.mxe)&&f){a.ter.push(f);b=b||{};var c=f.logLevel||b.logLevel;c&&c!==k&&c!==m&&c!==n&&c!==p||a.ec++;c&&c!=k||a.ecf++;b.pageURL=""+(e.location?e.location.href:"");b.logLevel=c;b.attribution=f.attribution||b.attribution;a.erl.push({ex:f,info:b})}}function l(a,b,c,e,g){d.ueLogError({m:a,f:b,l:c,c:""+e,err:g,fromOnError:1,args:arguments},g?{attribution:g.attribution,logLevel:g.logLevel}:void 0);return!1}var k=“FATAL”,m=“ERROR”,n=“WARN”,p=“DOWNGRADED”,a={ec:0,ecf:0, pec:0,ts:0,erl:[],ter:[],mxe:50,startTimer:function(){a.ts++;setInterval(function(){d.ue&&a.pec<a.ec&&d.uex(“at”);a.pec=a.ec},1E4)}};l.skipTrace=1;h.skipTrace=1;h.isStub=1;d.ueLogError=h;d.ue_err=a;e.onerror=l})(ue_csm,window);

and

q(":",g.attribution||d.attribution,d.name);g.logLevel=d.logLevel;g.attribution&&console&&console.log&&console.log([g.logLevel||“ERROR”,a,“thrown by”,g.attribution].join(" “));C=[];fa&&(d=[].slice.call(arguments),d[4]=g,fa.apply(f,d))};D.prototype={logError:function(a,b,c,e){b={message:b,logLevel:c||“ERROR”,attribution:q(”:",this.attribution,e)};if(f.ueLogError)return f.ueLogError(a||b,a?b:null),!0;console&&console.error&&(console.log(b),console.error(a));return!1},error:function(a,b,c,e){a=Error(q(":",

it seems somewhere above the posted sourceparts of the error there is a warning

[WARN ] [mazonechocontrol.handler.EchoHandler] - Get notification sounds failed: {} …

Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 5 column 1 path $

at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385) ~[?:?]

at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213) ~[?:?]

... 80 more

nervermind it works again :open_mouth:

I’ve been waiting for this, now Alexa tells me when someone presses the doorbell (amazon dash button). Good work.

I am now using the binding but the reminder always triggers twice could that be a bug ?

See #189: Beta: Openhab2 AmazonEchoControl Binding (controlling alexa from openhab2)

1 Like

Apparently the binding has issues loggig in. The credentials are correct, an the state is
“OFFLINE - COMMUNICATION_ERROR Login fails.”

openhab.log shows

2018-03-09 23:21:49.394 [INFO ] [mazonechocontrol.internal.Connection] - Response maybe not valid
2018-03-09 23:21:49.632 [INFO ] [mazonechocontrol.internal.Connection] - Login failed:{}
org.openhab.binding.amazonechocontrol.internal.ConnectionException: Login fails.
        at org.openhab.binding.amazonechocontrol.internal.Connection.makeLogin(Connection.java:420) ~[?:?]
        at org.openhab.binding.amazonechocontrol.handler.AccountHandler.checkLogin(AccountHandler.java:248) ~[?:?]
        at org.openhab.binding.amazonechocontrol.handler.AccountHandler.lambda$0(AccountHandler.java:197) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.j
ava:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294
) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
~

I’m using amazon.de. Could it be they changed the login procedure so the binding fails?

No, normally this happens some time if you restart openHAB very often (should be fixed with beta 10), because the login requires an captcha. Normally this is gone automatically after 8-12 hours.

BETA 10 is available with many new features

You will find the download link and an updated description in the top of this thread

Hi all, before starting any conversation I have to thank michi for that great work!!

But I am struggling with adding an Echo Show, making me crazy.

I have 3 Echos, 1 Echo Dot and 1 Echo Show. I have no issues with adding “normal” Echos/Dots, things and items are working fine.

The Echo Show is found in the inbox, shown in the format:
Amazon ECHO SHOW
amazonechocontrol:echoshow:account1: MySerial Number

But when I try to take it over as a thing, Paper UI is showing an “ERROR: 409 - Conflict” and the log shows:

[WARN ] [g.discovery.internal.PersistentInbox] - Cannot create thing. No binding found that supports creating a thing of type amazonechocontrol:echoshow.

I have tried to define the Echo Show manually in the .thing file, but failed: the thing is online, but the channels/items have no effect

I set it up like this:
Thing amazonechocontrol:echo:account1:echoshow1 “[ECHO] Living Room” [serialNumber=“MySerial Number”]

Maybe someone can advise what I am doing wrong or how to set up a workaround. Has someone ever added an Echo Show yet?

I have the same error as Pekka, should I remove the Amazon Account thing for the next 8-12 hours or is it okay if it tries to login the whole time (i have beta 10)

Hi Ulrich,

Try to restart openHAB. It seems that the internal state of openHAB is wrong.

I think, this definition will not work because the thing need the bridge (Account) device. I’am not sure if this can be defined, if the account thing was created with the PaperUI. If you want create all Things, including the account in a file, take a look in the readme in the top most posting.

Best regards, Michael