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

@digitaldan Managed to get this working. Looks like the certs were the issue, replaced them and its now working nicely.

Question, if you have multiple OH2 instances, and multiple OH2 Cloud instances, is it just the cloud instance/config.json that keeps the notifications seperate? ie what stops one instance sending alerts to another? Im a little confused on how myopenhab.org does this

Not sure i understand. your OH instance uses the cloud binding to talk to a OH Cloud instance, the host is configured in the binding and defaults to myopenhab.org, but can be set to your own instance. Notifications sent to that OH Cloud instance (host) will use whatever GCM/APNS gateway and cert you have configured on that cloud instance, in turn those need to be coordinated with the mobile build you have registered for notifications.

Hi Dan, OK so nothing more is needed to run multiple instances of OH2/OH2 Cloud and IOS notifications.

A single cert, a single app. Multiple OH2 servers, Multiple OH2 Cloud instances all point to the same Apple gateway.

I tried installing this on a RaspberryPi and I have got most of it working with the exception of the app.js running properly.

When i execute ‘sudo node app.js’ it does not throw any errors (or logs to the console) and just reverts back to the command prompt after a few seconds and port 3000 is not opened. A ‘ps -f |grep node’ does not show node running - Any idea where I could be going wrong?

The only difference for me is that I had to manually install node.js as the package you referred to is not supported on Arm6. I installed 7.10 directly from the node.js site.

I got the whole cloud working on my own vps, although it is somewhat confusing that we setup SSL while the cloud connector seems to have to connect directoy to the node application via http.
in any case: I simply cannot get Alexa working the same as with myopenhab (using basic auth here)
I get the skill deployed but in the Alexa app, all items are not responding. In my openhab cloud, no app is shown as being connected…Asking Alexa to do something with specific items WORKS. Scenes like „living room“ do not work.

Am I missing something beyond the above mentioned tutorials (of which some are already outdated. -> make openhab sing to alexa)

Can somebody assist with connecting the actual Openhab instance?
It worked once for me but now the Openhab instance simply will not connect.
I put the same URL into the cloud connector under which my OH cloud is accessible and I created an account there with the same credentials whick work with Myopenhab.

The Openhab Log states simply “disconnect CLoud service (base url = localhost:8080 )”

No logs on the server that Openhab is being rejected or anything

Did you update the uuid and secret when moving to your own openhab cloud instance?
The ohcloud binding does not do much diagnostic logging, so can be difficult to debug.

What do you mean by updating? I actually used the same UUID/secret which is also used for the myopenhab account.
Is it required to use a different one?

regarding logs i do not see any at all, neither on the machine running the cloud nor on the openhab instance. To me it seems it is not even trying to connect. I swear it worked once when I set it up in a hurry, yet never did thereafter while trying to get Alexa to work with it.

Edit:

If I point Openhab to the local cloud instance directly by ip:3000 then openhab connects.

I can also access the server now via app. No idea why openhab is not connecting to the cloud via external domain name

Hello,
I have a Freenas Server with running Openhab in a Jail an my Clound in an Virtual Mashine
is there an option to install the Cloud Service in an Freenas iocage Jail
Ill stoped at an older bcrypt version. installed ist Version 1.1

Someone have an Idea ?

this will be the error:

gyp ERR! build error
gyp ERR! stack Error: gmake failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
gyp ERR! System FreeBSD 11.2-STABLE
gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /var/www/myoh.preussers.de/openhab-cloud/node_modules/hiredis
gyp ERR! node -v v13.2.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN grunt-qunit-node@0.1.0 requires a peer of qunitjs@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“freebsd”,“arch”:“x64”})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hiredis@0.4.1 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hiredis@0.4.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-12-08T21_42_21_670Z-debug.log

All working ok great tutorial, but what’s the best way to work with alexa? I tried the tutorial but I think it’s outdated I can’t configure it, anybody has recently success with it?

I followed that page about a year ago. Some steps are not up-to-date in that description. Using the page as a guideline I was able to setup my environment.

did you solve issue? I have same problem…

does anyone have an up2date docker-compose example for a personal openhab-cloud instance using traefik 2? i try to setup and integrate my own instance into my current infrastructure but all i get is a gateway timeout. i want to run oh-cloud from a subfolder (mydomain/openhab-cloud). maybe it is related to that. but i can manage it correctly for other services too.
all tutorials i found seem to be incorrect or outdated as they use traefik 1 for example.

I was running a own openhabcloud since ages on a Strato Ubuntu 16.04 64bit system. Now I try to reinstall the cloud on a fresh Strato server with Ubuntu 18.04 64bit system.

Unfortunately without luck.

Here is what I did:

sudo apt-get update
sudo apt-get upgrade

sudo adduser openhabclouduser
usermod -aG sudo openhabclouduser
su - openhabclouduser

sudo apt-get install software-properties-common
sudo apt-get install curl
sudo apt install nginx
sudo apt install ufw

sudo add-apt-repository ppa:certbot/certbot
sudo apt-get install python-certbot-nginx
sudo certbot --nginx

sudo rm /etc/nginx/sites-enabled/default
sudo vim /etc/nginx/sites-enabled/hostname.de

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name hostname.de ;

    root /var/www/hostname.de;
    index index.html index.htm;
    location ~ /.well-known {
    	allow all;
    }
}

sudo mkdir /var/www/hostname.de
sudo vim /var/www/hostname.de/index.html

<h1>Test</h1>

sudo nginx -t
sudo systemctl reload nginx

sudo ufw allow 'Nginx Full'
sudo ufw delete allow 'Nginx HTTP'

sudo ufw enable

sudo certbot --nginx -d hostname.de -d www.hostname.de
sudo apt-get install letsencrypt
sudo letsencrypt certonly -a webroot --webroot-path=/var/www/hostname.de -d hostname.de

sudo apt-get install build-essential redis-server mongodb python git
sudo apt install npm

cd /home/openhabclouduser

wget https://nodejs.org/download/release/v7.10.1/node-v7.10.1-linux-x64.tar.gz

sudo mkdir -p /opt/nodejs

sudo tar -xvzf node-v7.10.1-linux-x64.tar.gz -C /opt/nodejs/

cd /opt/nodejs

sudo mv node-v7.10.1-linux-x64 7.10.1

sudo ln -s 7.10.1 current

sudo ln -s /opt/nodejs/current/bin/node /usr/bin/node

# This is to verify the node version

node -v

# It should say 7.10.1 now

# After that just clone the repo

cd /var/www/hostname.de

sudo git clone https://github.com/openhab/openhab-cloud.git 

sudo chmod 777 openhab-cloud/

cd openhab-cloud/
sudo npm install

Here ist the error:

openhabclouduser@h1123736 : /var/www/openhab-cloud $ sudo npm install

npm ERR! Linux 4.15.0

npm ERR! argv “/opt/nodejs/7.10.1/bin/node” “/usr/bin/npm” “install”

npm ERR! node v7.10.1

npm ERR! npm v3.5.2

npm ERR! code MODULE_NOT_FOUND

npm ERR! Cannot find module ‘ansi’

npm ERR!

npm ERR! If you need help, you may report this error at:

npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:

npm ERR! /var/www/hostname.de/openhab-cloud/npm-debug.log

Any help is more then welcome

It looks like your npm version is too old. It is version v3.5.2 but a newer one is expected.
See e.g. Cannot find module 'ansi' · Issue #19912 · npm/npm · GitHub

Mine is

npm list -g| grep npm
└─┬ npm@4.2.0

while I have

dpkg -l |grep nodejs
ii  nodejs                                7.10.1-2nodesource1~xenial1
1 Like

Thanks for the hint.
Now I get another exception:

2020-09-24 17:45:05:055 error: uncaughtException: Cannot find module ‘bcrypt’
Error: Cannot find module ‘bcrypt’
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/var/www/hostname.de/openhab-cloud/models/userdevice.js:3:14)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/var/www/hostname.de/openhab-cloud/fcm-xmpp.js:8:20)
at Module._compile (module.js:571:32)
at Object.Module._extensions…js (module.js:580:10)
at Module.load (module.js:488:32)
2020-09-24 17:45:05:055 error: undefined

Maybe there is another clever idea for me.
Found this

npm install --save bcrypt-nodejs && npm uninstall --save bcrypt

but does not solve the problem

npm log:

18955 verbose stack Error: heapdump@0.3.7 install: node-gyp rebuild
18955 verbose stack Exit status 1
18955 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
18955 verbose stack at emitTwo (events.js:106:13)
18955 verbose stack at EventEmitter.emit (events.js:194:7)
18955 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
18955 verbose stack at emitTwo (events.js:106:13)
18955 verbose stack at ChildProcess.emit (events.js:194:7)
18955 verbose stack at maybeClose (internal/child_process.js:899:16)
18955 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
18956 verbose pkgid heapdump@0.3.7
18957 verbose cwd /var/www/2kiwis.de/openhab-cloud
18958 verbose Linux 4.15.0
18959 verbose argv “/opt/nodejs/7.10.1/bin/node” “/usr/bin/npm” “install”
18960 verbose node v7.10.1
18961 verbose npm v6.14.6
18962 error code ELIFECYCLE
18963 error errno 1
18964 error heapdump@0.3.7 install: node-gyp rebuild
18964 error Exit status 1
18965 error Failed at the heapdump@0.3.7 install script.
18965 error This is probably not a problem with npm. There is likely additional logging output above.
18966 verbose exit [ 1, true ]

Thanks for your help

Is that error message triggered again by running the installer after fixing the first problem ?
When I look into the node_modules directory located in openhab-cloud then besides others I see these directories:

bcrypt/       bcrypt-cache/ bcrypt-pbkdf/

With these versions ( command started from within the openhab-cloud directory )

npm list |fgrep bcrypt
├─┬ bcrypt@1.0.2
├─┬ bcrypt-cache@1.0.2
│ ├─┬ bcrypt@0.8.7
│ │   ├── bcrypt-pbkdf@1.0.2

( installed this some time agoooo so it could be that other versions are expected now )

1 Like

Hey,
I habe set up my own OpenHAB-cloud Server and it Works Fine. Nur somehow I still cant Expose any items. They still wont appear on my Page.

Hi OS_Benji,
I have the same problem. I just opened another discussion here:

https://community.openhab.org/t/items-not-exposed-even-on-a-personal-instance-of-openhab-cloud-is-it-like-myopenhab-org/109210

All the best, Marco

1 Like

Hi Felix,

Did you solve the issue with bcrypt ?

I installed the cloud a couple of years ago without major problems. But now the file system of my server crashed and I was forced into a fresh install.
What a mess!
It seems the cloud is no longer maintained.

If you have any hints to get beyond the unavailable bcrypt package, please let us know.

Thx
-bernie

PS: in an earlier version of this post I falsely addressed Wolfgang: sorry!