OpenHab2 control Alexa Skill


(Rajeev) #1

Hi

I have trying to control Alexa skill through OpenHab. I have downloaded the required binding _org.openhab.binding.amazonechocontrol_2.4.0.201808261949.jar file and placed it /opt/openhab2/addons folder. Please ref to the event log below. It seems amazon echo control goes ONLINE for a minute and then immediately become OFFLINE - throw Alert Configuration_Pending. Not sure where is the problem. I am trying to control a simple switch (On/OFF) functionality.

Openhab Event log*
2018-10-07 20:23:40.757 [hingStatusInfoChangedEvent] - 'amazonechocontrol:echo:account1:echo1' changed from UNKNOWN to ONLINE 2018-10-07 20:23:41.448 [hingStatusInfoChangedEvent] - 'amazonechocontrol:account:account1' changed from OFFLINE (CONFIGURATION_PENDING): Wait for login to ONLINE 2018-10-07 20:23:42.051 [hingStatusInfoChangedEvent] - 'amazonechocontrol:echo:232b79c6' changed from UNKNOWN to OFFLINE 2018-10-07 20:23:42.866 [hingStatusInfoChangedEvent] - 'amazonechocontrol:account:292e3f28' changed from OFFLINE (CONFIGURATION_PENDING): Wait for login to ONLINE

item file

Switch Alexa_UnderCabinet         "Cabinet Light"                         (UnderCabinet) {channel="amazonechocontrol:echo:account1:echo1"}

Appreciate your quick help.
Thanks!


(SiHui) #2

You are on the wrong track. There is an Amazon Alexa Skill and an Amazon Echo Control Binding which are completely different.
If you want to control switches you need to tag your items definition with [ "Switchable" ] or [ "Lighting" ] and use the Skill.


(Kris K) #3

What does the Amazon Echo binding do then? I must admit im struggling too its incredibly complex.


(SiHui) #4

Basically you have three options:

  1. without cloud service
    Use the Hue emulation service and tag your items according to the Homekit addon (just the tagging, nothing else)

  2. with cloud service
    Use the myopenhab cloud and install the Alexa Skill on your Alexa device and tag your items according to the Homekit addon (just the tagging, nothing else)

  3. Use the Amazon Echo control binding:

use echo device as text to speech from a rule
volume
pause/continue/next track/previous track
connect/disconnect bluetooth devices
start playing tuneIn radio
start playing Amazon Music
control of multi room music
show album art image in sitemap
speak a reminder message
plays an alarm sound
start traffic news
start daily briefing
start weather report
start good morning report
start automation routine
activate multiple configurations of flash briefings
start playing music by providing the voice command as text (Works with all music providers)
Automatic turn on your amplifier and connect echo with bluetooth if the echo plays music
If the amplifier was turned of, the echo stop playing and disconnect the bluetooth
The echo starts playing radio if the light was turned on
The echo starts playing radio at specified time
Remind you with a voice message, that a window is open for a long time and it is winter
Start a routine which welcome you, if you come home
Start a routine which switch a smart home device connected to alexa
Start your briefing if you turn on the light first time in the morning
Have different flash briefing in the morning and evening
Let alexa say ‘welcome’ to you if you open the door:

Also read the main threads for all of this:



(Rajeev) #5

Thanks for your quick response. Yes , I just want to control the smart plug connected to Alexa echo so that I can switch ON/OFF from my OpenHab dashboard as well.

Out of 3 option you suggested , my scenarios is close to option 2. But I have below questions.

  1. do I still need amazonechocontrol_2.4.0.201808261949.jar Files in Addons folder.

  2. how would my .things would look like. I need a channel to provide my Alexa device ID and Alexa amazon account ( amazon.de).

  3. I am not using PaperUI for binding. I generally prefer manually updating confit file. Am I doing anything wrong .

  4. I can see the switch button in my sitemap but there is no action happening to the smart plug if I turn it on or off.

Appreciate your quick help.


(SiHui) #6

No.

For option 2 you don’t need any Things.

No, you may install any Add-On through your addons.cfg file.

Check your logs for any errors. Make sure your myopenhab cloud is working and your Alexa Skill is installed and authorized.
Read through the links I provided on how to do that.


(Rajeev) #7

Thanks Sihui,

I followed the process as you suggested. However , I am not able to establish the connect. Please ref to the screenshot. It is endlessly waiting for the connection or throwing a SSE subscription error.

I can see through myOpenHab.org portal that it is connected with Alexa skill not sure where is the problem.

My item file just contain a simple line

Switch UnderCabinet   “UnderCabinet”<light>  (UnderCabinet) [“Switchable”]


(SiHui) #8

Make sure you are using the correct quotes and don’t forget that empty space, then let Alexa discover your item again:

Switch UnderCabinet "UnderCabinet" (UnderCabinet) [ "Switchable" ]

Either you have the wrong quote sign or that did happen when you posted your code without code fences:

" instead of


(zolakk) #9

I think there might be some confusion as to what is needed. @rajeev2301 said that his device is hooked to his Alexa device, not to openhab. To clarify how the different bindings/skills work, think of it this way:

Hue emulation (option 1) and the Alexa skill (option 2) are to allow Alexa to control devices that are running on an openhab install. The Alexa control binding (option 3) is to have openhab control an Alexa device, which is more in line with what it sounds he wants if I understand the request correctly. Unfortunately, I don’t think that the binding supports controlling Alexa “smart home” devices yet.


(Rajeev) #10

Zolakk,

You are right. I want to control a smart plug (Tuya ) connected to Alexa skill. My objective is to build a OpenHab dashboard and send switch ON/OFF instructurction to Alexa from OH2 to control the smart plug.

As you can see in the attached screenshot. MyOpenHab.org ( cloud connector) is taking instruction from OpenHab.

But not sure why there is no change happening at Alexa app on my phone. Devices connected to Alexa skill is still showing inactive however devices are working perfectly through voice command from Amazon echo dot.


(illnesse) #11

You can’t control devices connected to alexa via openhab afaik, not with any of the existing bindings anyway. The right way to go about this is setting up the tuya device with openhab via binding or tuyapi, then control its items tagged with [ “switchable” ] or similar via the openhab alexa skill to be able to access them through both alexa and openhab. Or write an alexa command interpreter using rules and the echo control binding. I’ve done all of the above, (tuya is great stuff) and i’d recommend tuyapi with nodejs and some echo control binding “lastcommand” rule scripting + alexa routine. Good luck :smirk:


(Rajeev) #12

Thanks Illnesse,

Looks like my best bet could be Tuya API. Could you please confirm if I can take inspiration from below github code and follow the instruction or do you have a better recommendation/link to download API and instruction?

There is one more link to ref. Let me know if this would suffice as well.

Thanks !


(Rajeev) #13

Folks! Please provide your valuable suggestion on above scenario.

Thanks !

Rgds/Rajeev