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

Tags: #<Tag:0x00007f0143a28f00> #<Tag:0x00007f0143a28dc0> #<Tag:0x00007f0143a28c80>

(Kris K) #102

Hi Guys

Set this up, shows online. Theres a link to your dashboard but I get this:


Any thoughts? notifications arent working.

(Geri) #103

Hello Guys,

thanks for that great tutorial. I am running OH 2.3 already in my home with plenty of devices but now started to implement my own private cloud instance. As i am in anyway running a vps for a long time this makes now perfectly sense. Great work!

So everything worked out fine so far, but the only issue i am now facing is that i could not get behind on how to change the standard listen port 3000 to any another one.

I cannot start up the installation as i have a Plesk Antivirus service running on the same port which cannot be changed - otherwise i would run nuts in future upgrades.

Could please just guide me or give me hints on how to approach to change the standard listen-port for the openhab cloud?

Thank you so much for your help - and again great work!

(Adam Edwards) #104

Haven’t tested it myself, but the port looks like it’s set in app.js line 286. Looks like you’d also need to edit the proxy port under /etc/nginx/sites-enabled/yoursitename to the newly defined port.

(Geri) #105

Thank you very much ae_0017 - this really helped. Now it works fine.
I also need to solve the XMPP authentication error - it is just a warning but i also want to get rid of it to ensure proper funcionatliy :wink:

(Adam Edwards) #106

Should just be a firebase thing. Give this a try. You don’t need to compile habdroid unless you plan to use it, but you do need to setup firebase and then edit your config.json “gcm” section in order to get rid of that annoying startup “error”.

(Geri) #107

Hello there,

so thank you everybody for tips, but i am still working to get the cloud instance run on my own VPS.

I have Plex Onyx installed because there are running a couple of websites, but i am really having hard times in getting it to run there.

I have installed the node.js plugin being able to setup the website with node.js. So far so good, but i am always getting this error:

24595#0: *502 directory index of “/var/www/vhosts/blabla/blabla/” is forbidden

I am using nginx as a proxy/reverse proxy in front of apache with plesk. Now - when i am allowing directory indexing i am seeing all the files instead of the webinterface and i tried many things around but could not figure out why.

When i am doing “node app.js” and curl it from the host with http link it is working fine…

But now when i am inserting the link with the port e.g. then i am getting another error:
*502 upstream timed out (110: Connection timed out) while reading response header from upstream

Any ideas to get it running? Thank you so much for your help!

(J Wee) #108

Is it possible to setup your own openhab-cloud (docker) in a nextcloud (docker), all on the same ubuntu VM in esxi?

With openhab (docker) also on the same ubuntu VM?

(Geri) #109

Hello again,

i think i make a step forward, identifying that there is some problem with modules in the installation.
does anybody has a glue on how to solve that?
I have been trying to repair headpump with “nv V=1 npm install heapdump” but still have the error mentioned below:

Raw process output:
2018-06-26T11:41:17.067Z - error: uncaughtException: Cannot find module ‘…/build/Debug/addon’ date=Tue Jun 26 2018 13:41:17 GMT+0200 (CEST), pid=13553, uid=10000, gid=1003, cwd=/var/www/vhosts/, execPath=/opt/plesk/node/9/bin/node, version=v9.10.1, argv=[/opt/plesk/node/9/bin/node, /usr/share/passenger/helper-scripts/node-loader.js], rss=25174016, heapTotal=11354112, heapUsed=7272632, external=174676, loadavg=[0.080078125, 0.0166015625, 0.00537109375], uptime=659986, trace=[column=15, file=module.js, function=Module._resolveFilename, line=543, method=_resolveFilename, native=false, column=25, file=module.js, function=Module._load, line=470, method=_load, native=false, column=17, file=module.js, function=Module.require, line=593, method=require, native=false, column=25, file=/usr/share/passenger/helper-scripts/node-loader.js, function=Module.require, line=80, method=require, native=false, column=18, file=internal/module.js, function=require, line=11, method=null, native=false, column=15, file=/var/www/vhosts/, function=null, line=18, method=null, native=false, column=30, file=module.js, function=Module._compile, line=649, method=_compile, native=false, column=10, file=module.js, function=Module._extensions…js, line=660, method=.js, native=false, column=32, file=module.js, function=Module.load, line=561, method=load, native=false, column=12, file=module.js, function=tryModuleLoad, line=501, method=null, native=false], stack=[Error: Cannot find module ‘…/build/Debug/addon’, at Function.Module._resolveFilename (module.js:543:15), at Function.Module._load (module.js:470:25), at Module.require (module.js:593:17), at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25), at require (internal/module.js:11:18), at Object. (/var/www/vhosts/, at Module._compile (module.js:649:30), at Object.Module._extensions…js (module.js:660:10), at Module.load (module.js:561:32), at tryModuleLoad (module.js:501:12)]

thanks for any assistance!

(John H) #110

@Flavio_Costa I’m curious if you or anyone else happened to be able to get a private OAuth2 provider to federate the on-prem openhab-cloud with the Alexa Skill. I currently have an ADFS instance setup that I can use, I just don’t know how to craft the claims rule nor do I know how to craft the auth provider for openhab-cloud. Also, I’m curious as to what needs to happen within openhab-cloud’s code to make it accept claims tokens from my claims provider. Does anyone know if there’s a walk-through on how to setup OAuth2 for openhab-cloud. I can only assume this is possible since the public version does it already.



(Flavio Costa) #111

Hi John, I have never tried any integration with Alexa, and I’m not really an Alexa user.
I remember some months ago certain discussions about a (then) new action to integrate with Google Home, but I have not followed up on that afterwards so I’m not sure what the status on this is.

On the Eclipse SmartHome framework, there is some new development regarding a OAuth2 client, but I haven’t checked that yet as I am currently working on other topics. I plan to eventually go back to openhab-cloud, but that will probably still take some months.



(Pedro Garcia) #112

I have my own instance of openhab-cloud running, and integrated with Alexa and IFTTT.

Not sure it is the last updated version from GitHub, as I set it up a couple of months ago, but I do not dare touching it, as I had to tweak it “a bit” to make it work.

I could not find too much documentation on it (at all) so I had to hack and go through the code…

I have no time to document it, but if there is interest I can share what I did. Maybe somebody with more time than I could document a how-to then… :slight_smile:

I created a couple of JS scrips to make me “superuser” in my own openhab-cloud (no, the admin created one is not), and to define the keys and IDs for oauth. I will share these, but will take some time.

For IFTTT I had to create my own service (unpublished) creating manually the API call definitions. Takes some time, and trial and error.

For Alexa, there is a script that creates a bundle, and more or less it can be done, but it took me some time (I had no experience with AWS and lambdas), and you need to create an AWS account.

If you do not have experience on this, without a proper step by step guide it is not for newbies…

(Kris K) #113

Hi All

FIXED, a reboot was all it needed.

(shane kevin) #114

Please could you please show us how to config the ifttt thing in cutsom oh-cloud, thank you so much!!

(Pedro Garcia) #115

Hi @kevinshane,

You need to create a developer account in IFTTT (without paying I think I remember you could only use 4-5 “test” users)

Are you interested in the oh-cloud setup (setting up the oauth tokens, etc), the IFTTT part, or both? I need to document it and it may take some time. Will give it a try in the coming days in this post, but just to prioritize.

Best Regards,

(Pedro Garcia) #116

In general, to be able to add Oauth clients (amazon, google, ifttt, etc) to my OH-Cloud custom installation, I use this custom created script.


// Author: Pedro Garcia. Please feel free to redistribute and modify at wish keeping this line :)

var config = require('./config.json'),
    mongoose = require('mongoose'),
    system = require('./system'),
    MongoConnect = require('./system/mongoconnect'),
    OAuth2Client = require('./models/oauth2client'),
    OAuth2Scope = require('./models/oauth2scope'),

clientName = process.argv[2];
clientId = process.argv[3];
clientSecret = process.argv[4];

if (!clientName || !clientId || !clientSecret) {
    console.log('openHAB-cloud: Usage: node addoauth.js <clientName> <clientId> <clientSecret>');

mongoConnect = new MongoConnect(system);

client = new OAuth2Client ({
    name: clientName,                           // Client name
    clientId: clientId,                         // Client oauth2 id
    clientSecret: clientSecret,                  // Client oauth2 secret
    // homeUrl: "",
    // icon: String,
    // active: true,
    // created:,
    // last_change:

scope = new OAuth2Scope ({
    name: clientId,                             // name of the scope
    description: clientName,                    // description of what this scope permits to do
    // valid: true,
    // created:

console.log('Creating oauth2 scope'); {
    if (error) console.log('Error: ' + error);
    else console.log('Scope created');
    console.log('Creating oauth2 client'); {
        if (error) console.log('Error: ' + error);
        else console.log('Client created');

Create it in the base openhab-cloud directory and execute it with:

#> node addoauth.js
openHAB-cloud: Usage: node addoauth.js <clientName> <clientId> <clientSecret>

For sure there is a better way. If so, please let me know :slight_smile:

(Kris K) #117

Hi Guys

Does this allow, once setup, your Android phone to setup a HTTPS connection to your OH2 instance? by setting up the URL of your machine under the ‘REMOTE’ part of the App?

I cant connect but can open a web browser session to https://serverurl from the internet which takes me to the openhab cloud login page.


(Pedro Garcia) #118

Yes. You will need a fix IP or some other means (i.e. dynamic DNS) to resolve the name of your server. I would also strongly recommend you to use a real certificate (if you are security-aware).

You do not need anything from my previous post for this to work, anyway: it is related to integrating the custom instance with third party services through OAUTH.

But if you just want to connect remotely, and do not have a reason to run your own instance, I would also recommend you to use the openhab-cloud instance from

Best Regards,

(Kris K) #119

HI Pedro

Ive got an ip and dns name, if i use it with port 443 as the remote server in the OH2 app, it doesn’t connect.
By using this instance, in my Android client do I configure https://url

And then in nginx, i forward to 3000? Its not very clear and this is driving me insane


(Kris K) #120

Can anyone confirm what needs to go into here?

(Pedro Garcia) #121

Hi @dastrix80,

If the cloud instance is running on the same computer or network as the openhab instance, you can address it by the local address as in the image you sent.

If the cloud instance is on Internet, you need to point to the public address (i.e. https://myhomedomain/)

Answering your previous question: yes, you need to secure your cloud server behind a proxy. I use a highly customized Apache, so I cannot help you on nginx, but there are some how-to’s and tutorials already around.

Just make sure you enable proxying of websockets requests, to avoid having your openhab instance constantly polling your cloud instance

Best regards,