Make yourself OpenhabCloud Staff/Admin

HI, I recently installed my own OpenhabCloud on a VPS. It’s running just fine and has greatly improved the overall experience of OpenHAB :slight_smile:

I would very much like to configure my own account as staff/admin so i can view stats and perhaps for other stuff i noticed various script for.

Could someone please tell me how to configure someone as admin.

I have a script called “makeadmin.js” in /var/www/openhab-cloud but upon execution is throws the following error: openHAB-cloud: mongo connection error: MongoError: field missing/wrong type in received authenticate command

Thanks in advance!

Found my own solution :slight_smile:

Mongodb seems to be setup without a username and password but the makeadmin.js script is trying to use an empty username and password.

in the makeadmin.js script change:

mongoose.connect(‘mongodb://’ + config.mongodb.user + ‘:’ + config.mongodb.password + ‘@’ + config.mongodb.hosts[0] + ‘/openhab’, function(err) {


mongoose.connect(‘mongodb://’ + config.mongodb.hosts[0] + ‘/openhab’, function(err) {

After this run "node makeadmin.js and you will get a notification saying user was added as staff.

This will now show a new " staff" menu option for the staff user.

1 Like

Worked for me :slight_smile:
So you could see if somebody else has registered to your cloud, if you didn´t disabled registration…

1 Like

Hi guys, how did you manage to disable the registration?

You can find this here


Hi, I add the

"registration_enabled": false

But I can continue to make registrations maybe I loose something?

Maybe it could be better if you change

mongoose.connect('mongodb://' + config.mongodb.hosts[0] + '/openhab', function(err) {


mongoose.createConnection('mongodb://' + config.mongodb.hosts[0] + '/openhab', function(err) {

at least on the makeinvite.js to avoid the

Error while connecting from openHAB-cloud to mongodb: Error: Trying to open unclosed connection.


1 Like

That pull request was just merged today so make sure you have the up to date code or registration_enabled does nothing.

I have raised Feature Request issue for it.

So, if anyone already fixed it, please submit the pull request.



thats not a bug ;-).
So please check the code and make yourself staff (do it yourself :slight_smile: )
There is a script that you can find if you look into the project sources.
BR Mehmet

Hi there.

I have gotten the dockerized openhab-cloud image up and running. I have successfully registered myself as a user. I would now like to remove the register option before I expose the openhab-cloud instance to the internet. How should I achieve this without removing the registration I have already set up?

In config.json, I set
"registration_enabled": false

And then I rebuild the app-1 docker image only via
sudo docker-compose build app-1


Edit: Is there any way to avoid having to rebuild the entire app after changing some setting in the config file?

1 Like

@ScheissSchiesser could you help me set up my dockerized openhab-cloud? I cloned the repo and I am trying to follow the instructions. So far, the only edit I made in config.json is on the line for host…

“system”: {
“host”: “<>”…

The result is 502 Bad Gateway at I’m having trouble understanding the required configuration edits. I would be grateful for an assist. Thx

1 Like

Here is an update: I confirmed the database name for mongodb is the same in docker-compose.yml and config.json i.e. “openhab”. However, the logs below show a problem with mongo and redis. I’m not sure where to go from here.

app-1 | Option polling duration is not valid. Please refer to the README.
app-1 | 2018-03-11T23:44:51.884Z - info: openHAB-cloud: express server listening on port 3000
app-1 | 2018-03-11T23:44:51.889Z - error: openHAB-cloud: Redis error: Error: Redis connection to failed - connect ECONNREFUSED
app-1 | Warning: connect-redis reported a client error: Error: Redis connection to failed - connect ECONNREFUSED
app-1 | 2018-03-11T23:44:51.890Z - error: openHAB-cloud: Redis error: connection is closed
app-1 | 2018-03-11T23:44:51.893Z - error: code=UNCERTAIN_STATE, command=AUTH, args=[password], code=ECONNREFUSED, errno=ECONNREFUSED, syscall=connect, address=, port=6379
app-1 | 2018-03-11T23:44:51.906Z - error: openHAB-cloud: Error while connecting from openHAB-cloud to mongodb: MongoError: connect ECONNREFUSED
app-1 | 2018-03-11T23:44:51.906Z - error: openHAB-cloud: Stopping openHAB-cloud due to error with mongodb

1 Like


you need to rename the name of mongo and redis in the config.json from localhost to mongo and redis (see readme for docker).

There will be some major updates regarding docker and docker compose soon.

Also regarding changes:
You can easily rebuild e.g. app-1 by calling the proper docker-compose command:
docker-compose build app-1.

The app config.json is read as system config and you might (in normal cases) restart the app to reload it. But with the docker build the conf is copied into the container and you can connect to that container and modify config.json and restart app.

BR Mehmet