Private openhab cloud and alexa

Hi,

I have a running private openhab cloud instance on my server and looking to get the alexa skill to work with it.

Can someone point me to a tutorial or description on how that can be done (I can only find bits and pieces when searching for it)

Thanks,
Johan

Is this not enough?

1 Like

@JayJayJanssen

You could also try this:

https://heathpaddock.com/2017/02/02/making-amazon-echo-alexa-sing-to-openhab2/

Between both of them, you should be able to get it running. Any questions feel free to ask - the Readme is far too basic and the Heath page fills in most gaps but isn’t totally there.

I’ve set it up and it works

Thanks for the feedback/guidance.
I found another way to get this done, and was curious what the community thinks about this (as some may find this a hack).

I have my openhab running on a raspberry pi (with openhabian). This openhab instance connects to my “private cloud server” and Alexa doesn’t work with this instance in its current form.

I installed a second instance of openhab in a docker image on the same raspberry pi (this doesn’t have to be in a docker or on the same raspberry pi; can be on any hardware in the same network). The 2nd instance is configured the exact same way as the first instance (from items, things point of view) with the difference that the second instance connects to the standard openhab cloud.

The things, items files are the same on both instances. I removed the sitemaps and rules from the 2nd instance. This second instance of openhab is in principle my interface to Alexa and it works just fine.

The first instance is connected my private cloud server and used to manage the sitemap, etc.

My home is mostly using MQTT based HW/switches/lights/pool/audiosystem, philips hue and wemo. All those continue to work fine with this dual setup.

Not sure I quite follow the need to have 2 OH instances, one connects to the cloud (myOpenHab.org), and one to your own cloud-connector.

Using the provided README, I am trying to setup the Alexa Skill. But somehow I get stuck.
What I have done so far:

  1. Create an AWS account (actually, I already had one
).
  2. Create an Amazon Developer Account (using the same AWS account).
  3. Checked the installed node.js version with node --version: v10.15.2
  4. Create AWS credentials for ASK with these AWS instructions. Created an account, policy and assigned it to a new group as per AWS instructions.
  5. Saved the ID and Secret to be used in ask init later.
  6. Run sudo npm install -g ask-cli. .
  7. Run sudo ask init --no-browser and authorize the ASK CLI.
  8. Updated the ~/.aws/credentials file with IS, Secret and region us-east1 - to use English (US).
  9. Created Login with Amazon credentials.
  10. My private openHAB Cloud instance is accessible from the internet and uses an LE certidicate.
  11. Clone the repository: git clone https://github.com/openhab/openhab-alexa.git into ./openhab-alexa.
  12. Copy the ./openhab-alexa/lambda/smarthome/config-sample.js file to 'config.js` and uncomment and update the three settings: the URL points to my OH Cloud instance, and the OH Cloud login credentials are also added.
    Note that in the README, the explanation of changing the config.js is before the instruction to clone the repository, so there is no config-sample.js available yet at that moment.
  13. Deploy the skill and the lambda function with ask deploy.
  14. Setup skill account linking using the skillId from step 13 and my OAuth2 cofig: ask api create-account-linking -s <skillId>. Fill in the details, including Client ID and Secret from step 9, which results in “Account linking created successfully”.
  15. Enable skill with account linking: That’s where things get a bit confusing. When going to the Alexa Skill Console (clicking on the link in the README), I don’t get a “Dev Skills” tab and no mention of openHAB. Instead, I see the OOBE screen for Amazon devices like Echo (Dot). If I skip that step (there is an option at the bottom), I enter the Alexa screen where you can play music, add skills, change settings, create Lists, etc. which just hangs. Whichever menu entry on the left I click, no information is actually showing (just the ‘waiting ring’).

What am I missing here?

UPDATE: Logoff and Logon again works miracles here. Looks like I have now linked the skill. Next step is metadata and discovery


1 Like

Looks like I got stuck on the final step: account linking in the Alexa Skill Console. Although I specified both US and EU redirect URL’s (Account Linking and Account Linking), I still get an error when I try to enable it in the Skill Console:

Error Summary
400 Bad Request
The redirect URI you provided has not been whitelisted for your application. Please add your redirect URI in the ‘Allowed Return URLs’ section under ‘Web Settings’ for your Security Profile on Amazon Developer Portal.
Request Details
client_id=amzn1.application-oa2-client.>>REDACTED<<
response_type=code
state=A2SAA
rU7
scope=profile
redirect_uri=https%3A%2F%2Fpitangui.amazon.com%2Fapi%2Fskill%2Flink%2F>>REDACTED<<

The mentioned redirect URI in the error message is actually specified when I created the account linking (as is the EU URI).

One thing I could not understand clearly, is the difference between the Reciprocal URI and the Redirect URI that where asked by the ASK command when performing skill account linking. I specified the Alexa redirect URL’s at the latter prompt. This additional prompt
“Optional* RedirectUrls for App-to-App Account Linking (separated by comma):”
is not mentioned in the README.

Replying to my own post

I figured it out, more or less. After I added the redirect URLs both at the ask api create-account-linking command (in response to the last prompt not documented in the README) as well as in the Developer Console under Login with Amazon, I could finally complete the steps!

is anyone able to provide a simplistic step by step to get alexa to speak to my openhab instance, the above still assumes a level of knowledge I don’t have ?

I have succesfully setup the openHAB Cloud and a Amazon Alexa and IFTTT connection, i will provide a step by step manual when i get Google Home to work, and when i figure out how to get te OpenHAB-Cloud instance stable because al my devices connected to it keep strugling with keeping a permanent connections to te OpenHAB-Cloud server.

Maby someone who got this stable and can help with it ?

Hi Jorn,
does this

mean Alexa asks you to check the network connection because the device cannot be reached and in the Alexa App e.g. switches toggle between their current state and not reachable via network ?

Yes, it is.

This problem is caused by the private hosted Openhab-Cloud keeps disconnecting, i started a topic about it here: Custom Openhab-Cloud -> Connection dropping

Hope somebody can help with this issue, buth i’m looking into it as we speak to get Google Assistant to work fully with the private hosted openhab-cloud. The connection error seems to be an issue that is probably existing in the github repo.

Hi Jorn,
from your description it seems that I had a similar / the same problem ( see https://community.openhab.org/t/switches-occasionally-do-not-react-are-not-updated/ ). I had to make sure that the keepalive_timeout of the reverse proxy is long enough.

1 Like

Hmmm buth from what i’m looking at is in the log info of the openhab instance where it shows me that it disconnects all the time

EDIT:
@Wolfgang_S Its seems that after setting the keepalive to OFF is does not disconnect any more :smiley:
Note to make: i’m using Apache2 becausse of load balancers on that server that are setup and i don’t want to mess with again :smiley:
The State of the items keeps going away what the reason is for that i will still need to resolve :confused:

1 Like

Note to the people experimenting with this, it is better practice to set the keepalivetimeout to 60seconds.
I now have a stable connection to the private cloud server.

Buth i still get hangups on the alexa socket, will look further into this.

@willplaice If i get everything to work perfectly i will post a tutorial on how to setup everything with you’re own details and texts.

1 Like

All was working well in my private openhab cloud and alexa
now alexa tell me that my skin is disabled but it’s not disabled
what could be?

@epicurean @willplaice

Is there still intrest in a tutorial on how to setup OpenHAB Private cloud with IFTTT, Amazon Alexa en Google Assistant?

Due to the Covid-19 Virus, we are currently in a Lockdown Lite (note the Lite, its Belgium -_-), so i have some spare time, if there is intrest i will create a full up to date tutorial.

2 Likes

Jorn, it’s interesting for me regarding to openhab private cloud and Amazon alexa assistant.

Thank you in advance.

Absolutely!!. Much Thanks for putting aside time for this