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

@jbr27 Is there anything that has to be configured to enable basic authentication against openhab-cloud or is it enabled by default?

I think it is enabled by default since I can connect to https://youropenhabcloud.tld/rest/items and view the json-data with my prior registered credentials.

EDIT:
I researched a little bit and found a migration guide to convert payload v2 to v3. (https://developer.amazon.com/de/docs/smarthome/smart-home-skill-migration-guide.html)

According to this guide the skill has to be completely rewritten because of the drastic changes.
As in v2 one item had only some simple actions in a list like “turnOn”, “turnOff” or “setPercentage”, version 3 introduces so-called “Controllers” like “Alexa.PowerController” and “Alexa.BrightnessController” with different capabilities.

It is really not impossible but will require some man hours.

In conclusion: at the moment it is not possible to use the existing openhab-alexa code for “new users” as amazon disabled the creation of new alexa skills with payload version 2. People who created a skill earlier with payload version 2 can rename it in the developer interface and use it with the existing code.

1 Like

hi all,

still hope that somebody can help me :wink:

In the enumeration above:

login to Firebase with “normal” Google Account
add a project
add a mobile app
in the properties of that mobile app there is the “cloud messaging”-Tab with ServerKey and SenderKey
modify config.json like Joe_Lawrence describes:
Jid = Your_Sender_Key@googleapis.com
Password = server key

Can someone point me to the right buttons for step “add a mobile app”?

Thx
Stefan

Hi Stefan,

sorry for the late answer.
I have no idea how to describe it in a better way.
Open: https://console.firebase.google.com/ -> add Project -> add App -> open properties
Maybe the following picture will help you?

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.