OpenHab Cloud Installation

Hello all, I am trying to install Openhab cloud.
Here is my server details:
Ubuntu 14.04 32bit
Node.js 0.10.48
I followed the installation steps. Then I changed the file name “config-development.json” to “config.json”. In MongoDB I created database openhab.

Then I started node app.js and got the following error. What is the expected token?

2016-12-26T12:28:53.226Z - info: openHAB-cloud: Backend service is starting up…
2016-12-26T12:28:53.235Z - info: openHAB-cloud: Backend logging initialized…
2016-12-26T12:28:53.241Z - error: uncaughtException: /home/openhab-cloud/config.json: Unexpected token : date=Mon Dec 26 2016 07:28:53 GMT-0500 (EST), pid=18976, uid=0, gid=0, cwd=/home/openhab-cloud, execPath=/root/.nvm/v0.10.48/bin/node, version=v0.10.48, argv=[node, /home/openhab-cloud/app.js], rss=11317248, heapTotal=7130752, heapUsed=2348772, loadavg=[0, 0, 0], uptime=4596296.396334909, trace=[column=null, file=null, function=Object.parse, line=null, method=parse, native=true, column=27, file=module.js, function=Object.Module._extensions…json, line=482, method=Module._extensions…json, native=false, column=32, file=module.js, function=Module.load, line=356, method=load, native=false, column=12, file=module.js, function=Function.Module._load, line=312, method=Module._load, native=false, column=17, file=module.js, function=Module.require, line=364, method=require, native=false, column=17, file=module.js, function=require, line=380, method=null, native=false, column=14, file=/home/openhab-cloud/app.js, function=, line=35, method=null, native=false, column=26, file=module.js, function=Module._compile, line=456, method=_compile, native=false, column=10, file=module.js, function=Object.Module._extensions…js, line=474, method=Module._extensions…js, native=false, column=32, file=module.js, function=Module.load, line=356, method=load, native=false], stack=[SyntaxError: /home/openhab-cloud/config.json: Unexpected token :, at Object.parse (native), at Object.Module._extensions…json (module.js:482:27), at Module.load (module.js:356:32), at Function.Module._load (module.js:312:12), at Module.require (module.js:364:17), at require (module.js:380:17), at Object. (/home/openhab-cloud/app.js:35:14), at Module._compile (module.js:456:26), at Object.Module._extensions…js (module.js:474:10), at Module.load (module.js:356:32)]
2016-12-26T12:28:53.243Z - error:

Seems to be in the config file. Can you check if you renamed your config-production.json to config.json?
Is there any suspect character inside?

1 Like

Hello MARZIMA, Thank you for you time. Yes I’ve had renamed the config-production.json to config.json. I believe I need detailed instructions to set it up. I’m not sure what information I should put into config.json.

Can you please post me your config.json (production one) without your personal data.
I wanna double check and help you to set it up.
Don’t worry should be nothing big…I hope :slight_smile:

BR Mehmet

I am getting below error after copying production config to config.json.

error: openHAB-cloud: Error while connecting from openHAB-cloud to mongodb: MongoError: auth failed
2017-01-05T08:42:49.561Z - error: openHAB-cloud: Stopping openHAB-cloud due to error with mongodb

Mongodb is running

$ sudo systemctl status mongodb
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset:
Active: active (running) since Wed 2017-01-04 12:10:44 UTC; 20h ago
Docs: man:mongod(1)
Main PID: 17963 (mongod)
Tasks: 10
Memory: 63.9M
CPU: 2min 18.327s
CGroup: /system.slice/mongodb.service
└─17963 /usr/bin/mongod --config /etc/mongodb.conf

Jan 04 12:10:44 ip-172-31-4-64 systemd[1]: Started An object/document-oriented d

1 Like

I resolved the issue by manually creating username and password as below but now getting some other error.

$ mongo

MongoDB shell version: 2.6.10
connecting to: test
> show dbs;
admin    0.078GB
local    0.078GB
openhab  (empty)
> use openhab
switched to db openhab
> var a = { user:"openhab", pwd:"password", roles:["readWrite"]}
> db.createUser(a)
Successfully added user: { "user" : "openhab", "roles" : [ "readWrite" ] }

###$ sudo node app.js


2017-01-05T09:27:37.424Z - info: openHAB-cloud: Successfully connected to mongodb
2017-01-05T09:27:37.624Z - error: uncaughtException: undefined is not a function date=Thu Jan 05 2017 09:27:37 GMT+0000 (UTC), pid=27597, uid=0, gid=0, cwd=/home/ubuntu/openhab-cloud, execPath=/usr/local/bin/node, version=v0.10.48, argv=[node, /home/ubuntu/openhab-cloud/app.js], rss=113377280, heapTotal=95370792, heapUsed=63958880, loadavg=[0.080078125, 0.0166015625, 0.00537109375], uptime=867965.058384011, trace=[column=19, file=/home/ubuntu/openhab-cloud/node_modules/node-xmpp/lib/xmpp/stream_parser.js, function=new StreamParser, line=17, method=null, native=false, column=19, file=/home/ubuntu/openhab-cloud/node_modules/node-xmpp/lib/xmpp/connection.js, function=Connection.startParser, line=137, method=startParser, native=false, column=37, file=/home/ubuntu/openhab-cloud/node_modules/node-xmpp/lib/xmpp/session.js, function=, line=64, method=null, native=false, column=16, file=events.js, function=CleartextStream.g, line=180, method=g, native=false, column=17, file=events.js, function=CleartextStream.emit, line=92, method=emit, native=false, column=17, file=tls.js, function=, line=1452, method=null, native=false, column=17, file=events.js, function=SecurePair.emit, line=92, method=emit, native=false, column=10, file=tls.js, function=SecurePair.maybeInitFinished, line=1029, method=maybeInitFinished, native=false, column=13, file=tls.js, function=CleartextStream.read [as _read], line=521, method=read [as _read], native=false, column=10, file=_stream_readable.js, function=CleartextStream.Readable.read, line=341, method=Readable.read, native=false, column=25, file=tls.js, function=EncryptedStream.write [as _write], line=418, method=write [as _write], native=false, column=10, file=_stream_writable.js, function=doWrite, line=226, method=null, native=false, column=5, file=_stream_writable.js, function=writeOrBuffer, line=216, method=null, native=false, column=11, file=_stream_writable.js, function=EncryptedStream.Writable.write, line=183, method=Writable.write, native=false, column=24, file=_stream_readable.js, function=write, line=602, method=null, native=false, column=7, file=_stream_readable.js, function=flow, line=611, method=null, native=false, column=5, file=_stream_readable.js, function=Socket.pipeOnReadable, line=643, method=pipeOnReadable, native=false, column=17, file=events.js, function=Socket.emit, line=92, method=emit, native=false], stack=[TypeError: undefined is not a function, at new StreamParser (/home/ubuntu/openhab-cloud/node_modules/node-xmpp/lib/xmpp/stream_parser.js:17:19), at Connection.startParser (/home/ubuntu/openhab-cloud/node_modules/node-xmpp/lib/xmpp/connection.js:137:19), at CleartextStream. (/home/ubuntu/openhab-cloud/node_modules/node-xmpp/lib/xmpp/session.js:64:37), at CleartextStream.g (events.js:180:16), at CleartextStream.emit (events.js:92:17), at SecurePair. (tls.js:1452:17), at SecurePair.emit (events.js:92:17), at SecurePair.maybeInitFinished (tls.js:1029:10), at CleartextStream.read [as _read] (tls.js:521:13), at CleartextStream.Readable.read (_stream_readable.js:341:10), at EncryptedStream.write [as _write] (tls.js:418:25), at doWrite (_stream_writable.js:226:10), at writeOrBuffer (_stream_writable.js:216:5), at EncryptedStream.Writable.write (_stream_writable.js:183:11), at write (_stream_readable.js:602:24), at flow (_stream_readable.js:611:7), at Socket.pipeOnReadable (_stream_readable.js:643:5), at Socket.emit (events.js:92:17)]
2017-01-05T09:27:37.625Z - error:

1 Like

i am also in the same state, i receive the “undefined is not a function” however the app seems working, i registered raspi openhab to it and i can see notifications and items
however when i try the remote access it redirects me to myopenhab.org

would be great if there is any little bit detailed steps

Great to hear that it is working and Thank you. Please update the thread as and when you come across issues and working solution, otherwise I need to report them here :slight_smile:

Hi,

@Kiran_Patil
if you have installed mongo and all according the quickstart you should be good to start.
the steps should be to rename the config-production.json to config.json. Please make sure to adjust the standard config values to your needs!
If you have followed the quickstart you shouldnt create users in mongo. This can be done by the UI.
For the other issue, I made a PR at github.

You can ignore the “is not a function”, since the app will work. Going to fix that message.

@Basem_AlSaeed: Yes, you probably should change the URL in the OH2 cloud connector under configurations pane in paperui. Did you point your OH2 instance to your newly oh cloud server URL?
I think you just left the default URL, which has the URL to myopenhab.org

Let me know if that worked for you guys.
BR Mehmet

@tominagaf did it work? Csn you post me here the logs for adjusted config-production.json?

hello @MARZIMA, thanks for your support, apparently my cloud connector is configured with the right URL, this is why i can see my items status there and see my openhab online, only when i click to access my openhab it redirects me to https://home.myopenhab.org/start/index please check the attached screenshot, i just hided my personal email
thanks again for your help :slight_smile:

looks good! Yes that shouldnt be like that. Will open an issue at github. There it should redirect to “your cloud URL” to access the dashboard.

1 Like

Hello @MARZIMA thank you again. I did a fresh install and followed the quickstart.

I changed config-production to config.json and changed only baseurl with my server IP address.

I’m getting this error:

2017-01-07T23:03:48.204Z - error: openHAB-cloud: Error while connecting from openHAB-cloud to mongodb: MongoError: auth fails
2017-01-07T23:03:48.204Z - error: openHAB-cloud: Stopping openHAB-cloud due to error with mongodb

I tried this with Ubuntu 14.04 both 32 bits and 64 bits but no success.

****EDIT
when I run “mongo” I got this:
Server has startup warnings:
Sat Jan 7 17:48:36.213 [initandlisten] ** WARNING: You are running in OpenVZ. This is known to be broken!!!

**EDIT
It is running now, I need to use community version of Mongo BD because the issue above.

I access my server using its IP address.
How should I configure OH Could Conector Base URL for the openHAB Cloud server ?

Should I put the IP and port or just IP address:
Eg.
201.200.210.201:443

1 Like

Thanks for sharing the solution. I installed mongodb community edition with this link http://www.techrepublic.com/article/how-to-install-mongodb-community-edition-on-ubuntu-linux/, by removing the old version. Now I did not create user and password in mongodb and it runs with out auth failure.

What port cloud connector uses to connect with OH Cloud? Is it necessary manually add the port in the connector url?

My OH Cloud is running and I pointed my local instace to Cloud but it shows offline.

I added port as well to connector url as, http://xx.x54.x.2xx:3000 and it shows online for me.

I think we need to restart openhab server once.

one more thing, did you add openHAB UUID and Secret ?

Yes thank you, it works now. The port 3000 was missing in url.

Now I’m trying to figure out how to remote access my local instance, since the link is redirecting to myopenhab.org. Is there a manual URL we can use?

EDIT******
Just append /basicui/app to remote access while we for for fix

http://XXX.XXX.XXX.XXX:3000/basicui/app

Also, I would like to know how to connect to OH Cloud as Admin to see stats.

To get habpanel as remote access,

http://xx.xx4.x.2xx:3000/habpanel/index.html#/