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

I thought I reference my howto here: Tutorial: Own openhab-cloud and GCM / notifications (Firebase)

Maybe this is helpful for you, with a litlle trick it is possible to enable the v2 Radio Button Link

1 Like

Thank you very much!

Now the Alexa-Skill is fully working with my self hosted openhab-cloud :).

Wonderful! I’ll give it a shot tomorrow. I currently don’t have access to my vps, as the Hoster is patching the servers :grimacing:

Is the notification to mobil phones working if you setup your own openhab-cloud?

This is the only downside, no it isn’t. I could not find any documentation on how to configure it. But it isn’t that important for me, most of the notifications i need, I get from Apples HomeKit implementation i have configured with node red (garage door, windows, alarm system).

Hi,

Thought I’d provide a bit more information from the iOS side of things… the short version is it’s not a simple thing to get working.

In order to get push notifications to iOS devices, you need to be a member of Apple’s Developer Program. Then you could request an APN (Apple Push Notification) certificate and key that you’d place in the certs/ directory of the openhab-cloud application. This cert would be linked to a specific application id, which means you would need to recompile the OpenHAB client of iOS with that application identifier (since the official app is already using its identifier to receive notifications from the official cloud service).

It’s likely easier to use an app such as PushSafer or Prowl, or just send emails to your provider’s SMS gateway.

Hope this helps!

2 Likes

I was able to get an openhab-cloud instance running on Amazon with the Alexa skill using this tutorial, this guide for Alexa and Benji’s wonderful advice. Thank you for the great information!

Hello,

tried to adapt your tutorial with an existing “letsencrypted” apache-web-server. It seems it works, but if i start the app.js, port 3000 is exposed on the offical ip interface.

Here is the apache Site definition:

<IfModule mod_ssl.c>
<VirtualHost ww.xx.yy.zz:443>
	
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html
	
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	Include /etc/letsencrypt/options-ssl-apache.conf
	ServerName www.somedomain.org
	ProxyPass "/" "http://localhost:3000/"
	ProxyPassReverse "/" "http://localhost:3000/"
	SSLCertificateFile /etc/letsencrypt/live/www.somedomain.org/fullchain.pem
	SSLCertificateKeyFile /etc/letsencrypt/live/www.somedomain.org/privkey.pem


	Alias "/css" "/var/www/html/openhab-cloud/public/css	"
	Alias "/js" "/var/www/html/openhab-cloud/public/js"
	Alias "/img" "/var/www/html/openhab-cloud/public/img"
	Alias "/bootstrap" "/var/www/html/openhab-cloud/public/bootstrap"
	Alias "/font-icons" "/var/www/html/openhab-cloud/public/font-icons"
	Alias "/fonts" "/var/www/html/openhab-cloud/public/fonts"
	Alias "/js-plugin" "/var/www/html/openhab-cloud/public/js-plugin"
	Alias "/downloads" "/var/www/html/openhab-cloud/public/downloads"

</VirtualHost>

</IfModule>

And this is the conf.json of the openhab-cloud:

{
    "system": {
        "host": "localhost",
        "port": "443",
        "protocol": "https",
        "logging": "debug"
    },
    "express":{
      "key" : "some express key"
    },
    "mongodb": {
        "hosts": ["127.0.0.1"],
        "db": "openhab"
    },
    "redis": {
        "host": "127.0.0.1",
        "port": "6379",
        "password": "secret"
    },
    "mailer": {
        "host" : "somehost",
        "port": 465,
        "secureConnection": true,
        "user": "someuser",
        "password": "somepass",
        "from": "<your-mail>"
    },
    "gcm" : {
      "jid": "something@gcm.googleapis.com",
      "password": "password"
    },
    "ifttt" : {
      "iftttChannelKey" : "key",
      "iftttTestToken" : "token"
    },
    "legal": {
    	"terms" : "",
        "policy": ""
    }
    "registration_enabled": true
}

Please, need some advice to correct this…

Thanks in advance

Oliver

Hi Oliver,

I noticed this as well, and it’s a limitation in the current openhab-cloud code. I have a patch for it here:

https://bitbucket.org/hww3/ha/src/18b0f60270f162adf493b323cc566e491f3f0c15/openhabcloud/?at=default

Look at the file called app.js.patch. It adds an additional configuration option system: -> listen_address. An example for how it’s used is in the config.json file in the same directory.

I haven’t submitted a PR for it but that might be worthwhile. Anyone have any feelings about that?

Bill

Also, if anyone is interested, I’ve got a project that builds an image for use with Joyent’s Public and Private cloud service. It automatically sets up a let’s encrypt instance and fixes one or two other problems I discovered.

I know that Joyent isn’t one of the biggest cloud providers, but they’re reasonably priced (less than AWS and simpler to manage in my experience) and I’ve had very good luck with them. The project is available if anyone’s interested, and I can also provide a copy of the image itself if anyone wants to use it without having to build the image themselves.

The URL is in my previous message, and the openhabcloud “stuff” is in the openhabcloud directory.

Comments and suggestions are always welcome!

Bill

Hello Bill,

The Android client (HABdroid) had the same issue whereas recompiling the code was needed for notifications to work. It was fixed for Android by changing the client to make a request to openHAB Cloud (/api/v1/settings/notifications) to retrieve the sender ID to be used (PR #288).

Can’t the same solution be applied on the iOS client? From the documentation, I am under the assumption that iOS notifications also rely on GCM, so I would expect a similar solution to be possible there. Is this not the case? Do we really need to have that APN on the cloud instance?

Thanks,

Flavio

It’s my understanding that in order to get the device ID, you have to be an identified developer. This is a security mechanism to prevent unauthorized apps from stealing device information. FCM (the replacement for GCM) has a way to trigger notifications to be sent to iOS devices using the FCM APIs, but my understanding is that it still requires an APN certificate specific to the application bundle identifier… it’s just that the place the certificate is registered is on Google’s servers rather than on the OpenHAB cloud instance.

1 Like

If that is the case, then iOS notifications through your own openHAB cloud instance is a no-go for most users, including myself. However, I am not fully satisfied with the option to have the clients install yet another application such as Prowl, and receive notifications which are not visually branded as coming “from openHAB”.

It would be great to see myopenHAB act as an APN notification gateway, at least for iOS devices, so we can rely on its existing certificate and key. It would obviously require a communication mechanism between openHAB cloud instances which don not exist as far as I know. I will do some more research and maybe propose this as a new feature if it makes sense.

Yes, it’s unfortunate but necessary restriction related to ecosystem security. An alternate mechanism might be to split the notification functionality. You’d still need to maintain an account on both the official openhab servers (and a connection from each openhab instance).

Of course that would require a major rearchitecting of the cloud connector, cloud service and client…

Also possibly workable might be to have the openhab-cloud application be able to “pretend” that it’s an instance of openhab itself, and connect to the main openhab instance only for the purposes of sending notifications. That’s somewhat less direct (and certainly a hack) but it wouldn’t require changing anything except the cloud application run by individuals.

So to make it clear - am I able to register device (iPhone) using personal installation?

I cannot see device - I have installed cloud as in instruction, got domain, connecting via https - and no device on list :frowning:

From the information provided, your openHAB cloud is unable to send notifications to iPhone by default.

In order to have access to the resources to be able to do so you must enroll in the Apple Developer Program (currently at a cost of 99 USD per membership year).

I have a question regarding logging on openHAB cloud. Every 5 minutes, I see this on the logs:

2018-01-25T16:15:00.491Z - info: openHAB-cloud: every5min statistics collection job started
2018-01-25T16:15:00.509Z - info: openHAB-cloud: every5min statistics collection job finished

This is only generating clutter on the logs, so I would like not to see that. If I edit logger.js to change the transport logging from info to warn, then these logs go away, but also all other potentially relevant info-level logs such as the ones generated during startup.

Does anybody know a way to suppress those statistics collection job logs in particular?

I seem to not be able to pull my server info, 502 Gateway connection error… here is the error log with my IP and site info replaced with fill-ins

nginx/error.log

2018/01/27 20:16:05 [error] 4211#4211: *11 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: mysitecom, request: “GET / HTTP/1.1”, upstream: “http://[::1]:3000/”, host: "mysitecom"
2018/01/27 20:16:05 [error] 4211#4211: *11 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: mysitecom, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:3000/”, host: “mysitecom”

I did notice I was never able to pull openhab via ‘curl localhost:3000’, just sat blank. any ideas?
Thanks

EDIT:

  1. rebooted server
  2. re ran ‘sudo node app.js’
  3. tested ‘curl http://localhoast:3000’ (in new session, WORKED!)
  4. started nginx (‘services nginx start’)
  5. page loaded via url
  6. HAPPY NOOB!