Setup your own openhab-cloud (myopenhab) server/instance

Tags: #<Tag:0x00007f0147a1fc80> #<Tag:0x00007f0147a1fb18> #<Tag:0x00007f0147a1f988>

(Anjana) #142

Thank you very much for your reply. This really helps. However, I have 2 noob questions and hope you don’t mind.

  1. Is it a must to have oath2 established before any triggers, or can I use no authentication until I get things working?

  2. If you found IFTTT not reliable for location services, what is your recommended alternative?

(Pedro Garcia) #143

I have only tried with oauth setup.

I am using EpiGeoZone, even if it has been discontinued by the developer. For that, I use a custom PHP integration frontend, as it does not support OAUTH.

(Pasi Kettunen) #144

I can’t get this working. I installed this on Ubuntu in AWS, got some weird problem with bcrypt. sudo node app.js returns immediately.

Then I tried the same with Ubuntu 64bit in VirtualBox. There sudo node app.js gives “node_redis: Warning: Redis server does not require a password, but a password was supplied.” It stays on until ctrl-c but curl http://localhost:3000 just gives Connection refused.

(Anjana) #145

You can ignore the Redis warning. Please follow the instructions here and let us know if it worked.

(Anjana) #146

Finally got the oauth part working with IFTTT. For the benefit of the rest, here are the steps I followed:

oauth2 setup for openhab-cloud

  1. From IFTTT API Tab select Authentication from left menu

  2. Select “My API has users with non-expiring OAuth2 access tokens” option

  3. Client ID: ifttt

  4. Client Secret: Type in any combination of long string of your choice

  5. Authorization URL: https://YOUR_DOMAIN/oauth2/authorize

  6. Token URL: https://YOUR_DOMAIN/oauth2/token

  7. Redirect URL:

  8. Save

Now, we need to add IFTT token information in to mongo db.

  1. Log in to your openhab cloud server
  2. Change the directory to your openhab-cloud installation folder
    cd /opt/openhab-cloud/
  3. Create addoauth.js using Pedro Garcia’s script over here
    sudo nano addoauth.js
    paste the script content
    press ctrl+x and Y
  4. run the script
    sudo node addoauth.js ifttt ifttt <that long string you typed in IFTTT as Client Secret>

Run connection test from IFTTT to see if everything works as expected!
Note: You have to update config.json to include IFTTT Channel Key and test token as below:

  1. Edit config.json file
    sudo nano /opt/openhab-cloud/config.json

  2. Update the iftttChannelKey and the iftttTestToken as below

    “ifttt” : {
    “iftttChannelKey” : “Service key from IFTTT API tab - General section”,
    “iftttTestToken” : “See below”

To obtain your iftttTestToken,

  1. Register a test user at your openhab cloud instance.
  2. Then enter those user credentials at the “Demo account login” section of the IFTTT API tab - Authentication section
  3. Run a connection test by clicking on the “Begin Test” button located at the “Connection Test” section of the API tab
  4. Click “Allow” when prompted to authorize IFTTT accessing your openhab-cloud
  5. Once test complete, Copy the “AccessToken” from the BODY of the RESPONSE of “Request Access Token” section. This becomes your iftttTestToken for the above config.jason update

Ah! one last point, don’t forget to Enjoy! :wink:

(Pasi Kettunen) #147

I read the linked instructions, and downgraded Node to 7.10.1 and now it seems to work.

I haven’t done proxy etc settings yet but I don’t expect any problems there.