angelnu / docker-ccu

Script to create a docker container with the CCU2 firmware
Apache License 2.0
33 stars 14 forks source link

DEPRECATION NOTE - merged into RaspberryMatic

Since I loved the additional features added by @jens-maus in (RaspberryMatic)[https://github.com/jens-maus/RaspberryMatic] I had been ussing some of his work here. In order to get the "full thing" he and I have merged the functions in this repo: see (RaspberryMatic)[https://github.com/jens-maus/RaspberryMatic/issues/786]. Features:

Migration:

Therefore I do not longer plan to keep updating this repository. If you believe that there are resons for a vanilla official CCU as container please open an issue here. If I do not hear any requests in 1 month I will set this repo in read-only mode.

docker-ccu

Homematic CCU firmware running as docker container on arm and (emulated) x86.

This project downloads the Homematic CCU2 firmware and re-package it as docker image. You can then start it on your raspi. Other ARM-based boards might also work (see Dependencies section). You can deploy on x86 but it will be slow and some components fail. I am working on a true multi-arch docker container for this.

An automated build pushes new docker images to Docker Hub. You can check there the available versions.

Support for CCU2 has been removed from the HEAD. Please checkout the ccu2 branch if you need to build the CCU2 images. There is also another Docker Hub repository with old CCU2 images.

Features

Not working

Dependencies

How to deploy

  1. ssh into the target computer (better an ARM device)
  2. git clone this repository
  3. (Optional) cp -a settings.template settings and edit settings.template
  4. sudo ./deploy.sh

    • you can also use env variables such as MAYOR_CCU_VERSION=2 to deploy a CCU2 firmware. See settings.template for all available options

    After the above steps you can connect to the :<port 80>. The CCU docker image will be restarted automatically when the computer boots: the container is started in auto-restart mode. With docker ps ccu you can see its status.

How to build

This is only needed if you do not use the already built docker container.

  1. git clone this repository
  2. (Optional) cp -a settings.template settings and edit settings.template
  3. sudo ./build.sh

How to update to a new CCU firmware

  1. git pull
  2. ./pull.sh
  3. ./deploy.sh

Optionally you can use the _CCUVERSION variable to select a particular version.

Your CCU settings will be preserved.

How to import settings from an existing CCU

You can move your settings from an existing CCU into the docker CCU, either via ssh or using the native backup/restore support in the CCU (recommended).

If you use a HM-MOD-RPI-PCB and the Homematic is not working after restoring the backup then likely your old system was running without compatibility with Homematic IP. You need to use the new dual-stack mode. The easiest way to achieve that is to execute the following command: docker exec ccu sh -c "rm /etc/config/rfd.conf && /etc/init.d/S61rfd restart && cat /etc/config/rfd.conf". After this please check that Improved Coprocessor Initialization = true.

Using the CCU UI (recommend)

  1. log into you HW CCU web ui
  2. go to Settings -> Security -> create backup
  3. go into the the docker CCU web UI
  4. go to Settings -> Security -> import backup

Manually copying files

Please notice that this method does not support switch HW versions: to update from HW CCU2 to docker CCU you need to use the UI

  1. Enable ssh in your CCU2. Instructions (in German) here
  2. ssh into your target computer
  3. sudo ./undeploy.sh
  4. rsync -av \[your CCU IP\]/usr/local/* /var/lib/docker/volumes/ccu_data/_data/
  5. ./deploy.sh

Cluster

You can deploy this docker container into a docker cluster with Kubernetes or Docker Swarm. This allows a High Available configuration where the home automation can stay up in the event of HW dying. This is usefull considering that a Raspberry is cheap so you should not depend on a single one to ensure your house stays warm ;-) .

Kubernetes

You can check this example of a high available deployment. There I keep the configuration into a cluster persistent volume (glusterfs) so if one of computers is down then the CCU is "just" redeployed automatically into another available computer.

Docker swarm

You can also deploy this docker image to a docker swarm. For this you need to:

  1. Change settings parameters
    • Set _DOCKER_CCUDATA to the absolute path of your shared folder. Example: _/media/glusterfs/ccu_
    • Set _DOCKERMODE to swarm
    • Set _DOCKEROPTIONS to --constraint node.labels.architecture==arm
  2. ./deploy.sh