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

myopenhab
myopenhaborg
openhab-cloud
Tags: #<Tag:0x00007f0146c1fa18> #<Tag:0x00007f0146c1f770> #<Tag:0x00007f0146c1f630>

(juppe1) #62

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


Official Alexa Smart Home Skill for openHAB 2
Official Alexa Smart Home Skill for openHAB 2
(Benjamin) #63

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).


(Bill Welliver) #64

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!


(dvzkul) #65

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!


(Oliver) #66

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


(Bill Welliver) #67

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


(Bill Welliver) #68

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


(Flavio Costa) #69

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


(Bill Welliver) #70

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.


Android device not registered in own cloud instance
(Flavio Costa) #71

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.


(Bill Welliver) #72

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…


(Bill Welliver) #73

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.


(Piotr "Rook") #74

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:


(Flavio Costa) #75

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).


(Flavio Costa) #76

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?


(Domino) #77

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!

(Jimmy Jones) #78

Nice Try, probably technically competent . But having to pay even a penny for any of this stuff makes it completely pointless.
It needs to remain totally open and free otherwise you have failed.
Have another go !


(SiHui) #79

Nice shout. :dizzy_face:
Tell this all the developers of free software packages who are doing the work in their spare time … for free.
Let me give you a nice link, especially for you: http://www.openhabfoundation.org/


(Jimmy Jones) #80

Thanks,
It seems strange to me that even quite talented coders have no common sense whatsoever !
Throwing money at an open source project , must lead to an imperfect solution.
A software project must be started correctly from ground zero otherwise it will inevitably lead to disaster and confusion.
I know I can’t afford this solution that’s for sure. PAYING for a VPS , is he kidding.


(SiHui) #81

Don’t worry, you don’t have to pay.

Use the free myopenhab cloud!
It is operated by the openHAB Foundation, I already provided the link above.
We, the openHAB foundation and sustaining members support the openHAB Foundation with a monthly fee, because we love the work the developers are doing for free.

So we are happy to pay for you. Just go ahead … and now I don’t feed the troll anymore :rofl: