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

myopenhab
myopenhaborg
openhab-cloud
Tags: #<Tag:0x00007f0146a007a0> #<Tag:0x00007f0146a00638> #<Tag:0x00007f0146a004a8>

(Jimmy Jones) #82

I don’t understand this reply . What about the fee for the VPS server
you mentioned ?


(nils2410) #83

nice tutorial, some addiditions:

letsencrypt to certbot:

 echo 'deb http://ftp.debian.org/debian jessie-backports main' | sudo tee /etc/apt/sources.list.d/backports.list
 certbot certonly -a webroot --webroot-path=/var/www/openhab.dxxd.net -d openhab.dxxd.net

run as a service

 nano /lib/systemd/system/openhab.service

insert the code below:

[Unit]
Description=openhab-cloud
After=network.target

[Service]
Type=simple
ExecStart=/usr/bin/node /var/www/openhab.dxxd.net/openhab-cloud/app.js
Restart=on-failure

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
service openhab start

question:
does anyone know how i link the instance to ifttt?


(Flavio Costa) #84

Open source and free software has nothing to do with not spending any money on it, what you’re saying is nonsense:
https://www.gnu.org/philosophy/free-sw.html

Letting people do whatever they want with their own time and money is a great start. :wink:


(Markus Gehlhaar) #85

Interesting. But some silly question. Why would one use myopenhab? What are the benefits?


(Jimmy Jones) #86

Now Now steady on.

What I said was obviously not nonsense. The article I was commenting on
stated that you need to subscribe to a VPS for the workaround/system to
work.

Please don’t assume that members of the public are just morons, try to
understand the meaning behind a comment. It was not meant to be nasty
just constructive.

I think we have been talking at cross purposes here.


(SiHui) #87

You may securely access your openHAB installation from outside your network without opening any ports on your router (which would be a security issue). That service is free and provided through the openHAB Foundation. Please be aware that this thread is about setting up your own cloud instance which has nothing to do with the free service from the openHAB Foundation.


(Bill Welliver) #88

Replying to my own post here:

I took a little time tonight and put together a rough (20 lines of code) proof of concept for this idea. I modified the copy of the openhab-cloud application I am running myself so that it connects to myopenhab.org and passes on just the notification requests. Amazingly, this works and push notifications are sent to my phone. So the idea isn’t as crazy as I initially thought.

That said, I’m not sure it’s worth it for most people, as it involves setting up accounts in 2 places and so on. I can provide details if anyone wants to develop the idea further.


(Flavio Costa) #89

Bill, I do appreciate the concept and I’d like to be able to send notifications to iOS too. If you share the details on how this was done, I’ll also try to make it work on my cloud instance and see if I have any ideas that could help improve it. Thanks!


(Bill Welliver) #90

I’ll try to make some time to clean up my changes this weekend. It’s not exactly production-ready; some points that need attention:

  • should be made configurable
  • modify the changes so that it can work with multiple openhab instances
  • documentation

I’ll definitely write up some documentation on how to get it working. The rest probably could use some soup discussion. :slight_smile:


(bernd_boehm) #91

As far as I can see there is no Docker image for myopenhab, right? Or did anyone already put together a Docker file for personal use?

[EDIT] searching helps … thx @ryandetzel


(Bill Welliver) #92

I’ve copied my changes into a fork of the openhab-cloud repository. There are 2 changes: first is a commit that allows the listen address to be specified. This is important the default configuration listens to port 3000 and is exposed to the internet unless a firewall rule blocks it. This change, or something like it ought to be submitted as a PR. I’m very busy (as you might tell by the time it took to get this message put together.

The other change connects a “sub” openhab-cloud to the main openhab cloud, and passes notification requests up the chain. This allows a user to set up their own openhab-cloud instance, and still have working mobile notifications.

It ought to be cleaned up, made optional, and also be modified to deal with the possibility of multiple openhab instances connecting. That said, it works and proves that the concept is viable. It could also be extended to allow iftt to work as well.

Note that in order for this to work, you’ll need to set up your openhab instance and phones in the official myopenhab before this will work… it literally passes the notification requests up the chain with you uuid and secret.

Hope this is of interest to someone (and please don’t flame me if it doesn’t work!) :slight_smile:


(Flavio Costa) #93

@hww3, thanks for the work on this! I’ve also been busy with other topics and I will try to get to that soon.

Unfortunately I still need to familiarize myself more with Git so I can see clearly what are the changes on your fork, and try them out. I actually do have mobile notifications working, but only on Android. Besides iOS notifications, it would indeed be interesting to use myopenhab.org as a relay for IFTTT or any other service that would generate extra effort or costs to host locally. To make the solution more general, perhaps it is possible to implement some kind of OAuth or single sign-on mechanism so the credentials from local openhab-cloud instances are somehow trusted by the main/central instance without having to setup the accounts in both places.


(Bill Welliver) #94

I agree that it would be nice not to have to register in multiple places (and I really like the idea of the IFTTT pass-through). I think, though, that getting phones to register would require logging on through the main cloud site, as I think that’s controlled by the developer cert (again, for security reasons).

I think the easiest way to see what changes were made is to look at the commits on the github website. There are two commits, one creates a setting that can be used to prevent the cloud connector from exposing itself unprotected on the internet. The other is the commit that passes notification requests on up to the official cloud service. If you look at the commits view and choose one of my commits, it will show you the “diff”, which is a list of things added and removed from the code. It’s pretty simple, partly because the concept ended up being easy to implement, but also because it’s not configurable, and doesn’t have much error checking, and … :slight_smile:


(Stefan Haupt) #95

hi all,

when connecting externally to my own openhab-cloud (via router port forwarding) I am presented a basic authentication browser window asking for username, password. This is NOT the openhab-cloud GUI but an additional authentication window, like htaccess apache file. Any idea where to configure this? my openhab-cloud user/pass configuration doesn’t work in this screen. when I connect via internal ip, I don’t see this window and can login directly with my known user/pass into the openhab-cloud web interface.

best regards

Stefan


(Bill Welliver) #96

Hi @StefanH,

I’ve noticed that I get a prompt like this if I’m not accessing the main page and my authorization token has expired. I haven’t been able to get past it (my username and password does not work), short of going back to the root of the site. Is it possible you’re running into this problem as well?

Best,

Bill


(Stefan Haupt) #97

I am accessing just the root page :-/


(Stefan Haupt) #98

I digged a bit deeper. It’s somehow related to the dyndns provider. Using two providers, both point to the same ip. when using http://DYNDNS1:3000 the openhab cloud GUI is shown. But http://DYNDNS2:3000 shows the basic authentication popup :-/


(Bill Welliver) #99

Hmm… I tried to replicate that problem and wasn’t able to, but one thing that is different for me is that I’m using https, which is routed through ngenix. Though I don’t know why that would be… if I am not authenticated I get routed to the login page. What browser are you using? I noticed that I get the popup only on Safari on my iPhone…


(Stefan Haupt) #100

tested with Chrome and IE. both show the basic authentication window.


(Stefan Haupt) #101

solution: don’t use a dns name that starts with subdomain HOME, like home.myserver.com
this will force basic authentication