Public Repository

Last pushed: a year ago
Short Description
Homeautomation FHEM with homebridge and sendmail (gmail preconfigured)
Full Description

FHEM is a home automation system. See http://fhem.de/fhem.html

The images provides FHEM 5.7 along with homebridge and sendmail (gmail preconfigured) for raspbian. Tested ans raspberry 3 with jessy and docker 1.10.3
Linux raspberrypi3 4.4.13-v7+ #894 SMP Mon Jun 13 13:13:27 BST 2016 armv7l GNU/Linux

To get you started:
1) create a runtime environment directory for the container to store your config as the container is stateless:
e.g:
mkdir -p /homt/pi/fhem_run_env
Place your fhem.cfg file as well as your own 99_myUtils.pm (or variants) in there.
If you want to use mail, place a gmail-auth file (see sample) in there as well (currently only gmail supported)

pi@raspberrypi3:~/fhem_run_env $ pwd
/home/pi/fhem_run_env
pi@raspberrypi3:~/fhem_run_env $ ls -ltr
insgesamt 80
-rw-r--r-- 1 root root 15692 Jun 25 15:56 fhem.cfg.demo
-rw------- 1 root root 194 Jun 25 15:56 gmail-auth_sample
-rw-r--r-- 1 root root 383 Jun 25 15:56 config_sendmail.txt
-rw------- 1 root root 68 Jun 25 16:03 gmail-auth
drwxr-xr-x 4 pi dialout 4096 Jun 25 16:07 homebridge
-rwxr-xr-x 1 root root 1678 Jun 25 21:52 start_runenv_fhem.sh
drwxr-xr-x 2 pi dialout 36864 Jun 25 22:40 log
drwxr-xr-x 9 pi dialout 4096 Jun 25 23:00 fhem

2.) create a start script to start the docker container:
export FHEM_RUNENV="/home/pi/fhem_run_env"

sudo docker run -d --name="fhem" \
-e TZ="Europe/Berlin" \
--restart=always \
--net=host \
-p 8082:8082 \
-p 8083:8083 \
-p 8084:8084 \
-p 8085:8085 \
-p 51826:51826 \
--device=/dev/ttyACM0 \
-v $FHEM_RUNENV:/fhem/run_env \
-v $FHEM_RUNENV/log:/opt/fhem/log \
-v $FHEM_RUNENV/homebridge:/home/fhem/.homebridge \
ralfkamphues/fhem:$1

NOTE: Put your fhem.cfg into <fhem_runenv>/fhem directory

On first start the container is providing a start_runenv_fhem.sh file in the runtime environment. you can modify this. A sync of the files between container and runtime environement might take additional time on first start. It will force an update of fhem (initially fhem 5.7 is provided), as well as an update on tablet-ui.
After the update a shutdown restart is initiated as well. So it might take a few minutes to get the container up-to-date.

The homebridge code can be found in fhem_run_env/log/homebridge.log

The fhem.cfg entry for homebridge on this container should be:
define FHEM.Homebridge.Status dummy
attr FHEM.Homebridge.Status room Homebridge
define FHEM.Homebridge dummy
attr FHEM.Homebridge event-on-change-reading state
attr FHEM.Homebridge room Homebridge
attr FHEM.Homebridge webCmd status:start:stop:restart
define FHEM.Homebridge.DOIF DOIF ([FHEM.Homebridge] eq "start") (set FHEM.Homebridge on, {system ("echo '/etc/init.d/homebridge start' | at now +0min")})\
DOELSEIF ([FHEM.Homebridge] eq "stop") (set FHEM.Homebridge on, {system ("echo '/etc/init.d/homebridge stop' | at now +0min")})\
DOELSEIF ([FHEM.Homebridge] eq "restart") (set FHEM.Homebridge on, {system ("echo '/etc/init.d/homebridge restart' | at now +0min")})\
DOELSEIF ([FHEM.Homebridge] eq "status") (set FHEM.Homebridge on, {system ("echo '/etc/init.d/homebridge status' | at now +0min")})
attr FHEM.Homebridge.DOIF room Homebridge

NOTE: I had to use "at" in order not to block my fhem.

Regarding sendmail.
If you use an other provider than gmail please modify the "config_sendmail.txt" file in <fhem_runenv> directory.
In any case: create a gmail-auth file with your login/password. See the template gmail-auth_sample

Docker Pull Command
Owner
ralfkamphues

Comments (0)