Architecture for home automation


#1

I’m having doubts on the architecture of what I’m trying to achieve, and I’d like some feedback. Here goes:

The idea: just like many people, I made my own limited home-automation. It’s pretty simple:

  • all of my “controllable” devices (mostly lights and wall-outlets) are electrically cabled to outputs of a few “zelio” machines (micro-PLC’s from Schneider), some with an extra power-relais, most lights directly (outputs support 8 amps on 230VAC)
  • I use push-buttons around the house, and each push-button has a direct cable to the zelio input, basicly closing the input when pushed
  • most inputs are 1:1 mapped to their output, and are toggles. In other words, a push on button for input 1 toggles output 1
  • on each zelio, there’s 1 specific input to switch off all outputs (a handy “all-off button”)
  • the zelio’s have an RS232 connector which I can connect to a computer via an RS232/USB cable, it allows reading and writing of the zelio

This all has been working for a few years now, no issues. I actually intalled this in 3 homes, all working fine.

I now want to integrate openhab. Openhab is some software you run on a computer (i want it to be a raspberry pi), and some native clients in IOS/android etc. It has a lot of bells and whistles, but in its simplest form it would allow me to use the iphone app to toggle the light, just like i do with a hard-wired push button now.

Enter resin.io. I don’t remember how I stumbled upon resin.io, but it looked like a lot of fun to play with (and it is!) with the RBP. It supports Docker, so I could (in theory) try to get the whole openhab running in a container, and deploy to the RBP’s in the homes. It has been very interesting so far, learning about cross-compiling, Docker etc.

I managed to get java running in the Docker container (on my own! proud), but so far openhab: not yet. It seems to have dependencies on dbus and some other stuff which I haven’t figured out yet.

But mostly: I’m not sure if this architecure is the best idea, although it’s probably more of a Docker-question than a resn.io-question. That single container would need to:

  • support java (done)
  • run openhab (trying), and somehow make it usable from any internet connection, not sure how to secure (vpn, grok, something else)
  • talk to the zelio’s using USB/RS232 (not tried yet, no idea how that would work in a docker container)
  • run SSH (not started, i like to log in to know what is going on, via VPN, because I don’t want to deal with NAT traversal)
  • have a per-home configuration of openhab, and the addressing of the different zelio’s

So, there, that’s pretty much the story. All hobby, fun trying and learning.

Any tips?


#2

@marnikvde I don’t have any java experience with java but you’re approach looks good.

Communicating with zelios over usb should be easy. (resin.io base images auto-mount devices for you using udev).

Regarding ssh, I suggest you use our web-terminal it uses our vpn so won’t have to set up your own. It’s also gotten alot better recently: https://resin.io/blog/spring-cleaning-the-new-web-terminal/

Per device configuration should be easy with resin’s per device environment variables. ref: http://docs.resin.io/#/pages/management/env-vars.md#per-device-environment-variables


#3

Thanks for the links, I tried the (new) webterminal already, but it feels weird not to be able to SSH in directly. For now, it does all I need.

Any hints on what base image to start from for a Raspberry Pi 3? I used resin/rpi-raspbian, but there are so many base images that I don’t know what to look for :smile:


#4

Hey @marnik,

resin/raspberrypi3-debian (https://hub.docker.com/r/resin/raspberrypi3-debian/) should be a good start for you, we also have language specific like node or python base images for each device available, details about base-images can be found in our docs here http://docs.resin.io/#/pages/runtime/resin-base-images.md.

About direct SSH, you can manage that by installing dropbear or openssh, we have the dropbear example project here https://github.com/resin-io-projects/resin-ssh-python :smile: