Skip to content

Docker Container for FHEM House-Automation-System - Full install with all dependencies

License

Notifications You must be signed in to change notification settings

JoschaMiddendorf/fhem-docker

Repository files navigation

Docker Container for FHEM House-Automation-System

Full install with all dependencies

This image of FHEM is based on Debian and runs on every possible docker host. The master branch (latest) is based on Debian Stretch. It has several Perl Modules installed, however if you are missing any modules, packages or features, don't hesitate to ask for it by opening an issue on GitHub, I'd love to improve this container in the future. https://github.com/JoschaMiddendorf/fhem-docker/issues/new

You can make your entire configuration persitent across updates and restarts by mapping the volume /opt/fhem to a directory of your choise. If the maped directory is empty prior to the first atempt to run the container, initial data will be extracted from the fresh install. Furthermore there are some goodies, predefinitions and helpers in the initial fhem.cfg whitch will make it easy for you to start over.


Features

  • mapable and self initialising volume /opt/fhem
  • Exposed ports: 7072 for FHEM-Tellnet and 8083-8089 for FHEM Web instances, Tablet UI and Webhooks. (you dont't have to expose them all)
  • Preinstalled haus-automatisierung.com theme
  • Preconfigured nice looking FHEM Web
  • Live FHEM log output via docker
  • Reliable start script for gracefull restart and shutdown handling without sending kill signals to FHEM
  • Docker Healthcheck to check FHEMs first defined FHEMWEB frontend for actual reachability
  • Configurable start method fhem.cfg or configDB
  • Constantly improved and maintained
  • Feature requests and feedback is highly appreciated

If you appreciate my work and if you use and like these container, consider to make a little donation.

paypal


Run:

docker run -d --name fhem-docker -p 7072:7072 -p 8083:8083 -p 8084:8084 -p 8085:8085 -p 8086:8086 -p 8087:8087 -p 8088:8088 -p 8089:8089 diggewuff/fhem-docker

Run with mapped volume on host:

docker run -d --name fhem-docker -v /my/host/directory:/opt/fhem -p 7072:7072 -p 8083:8083 -p 8084:8084 -p 8085:8085 -p 8086:8086 -p 8087:8087 -p 8088:8088 -p 8089:8089 diggewuff/fhem-docker

If you are using USB devices, you will need to mapp them to the container via the run command.

Check for usb devices on the host with lsusb:

lsusb -v | grep -E '\<(Bus|iProduct|bDeviceClass|bDeviceProtocol)' 2>/dev/null

and mapp them to the container by adding argument like this to the run command:

--device=/dev/bus/usb/001/002

Furtermore you can define the following environmental variables to customize the behavior of the container:

Timeout interval, in seconds, before container stopps when FHEM process terminates unexpectedly.

-e TIMEOUT=10

Your timezone according to POSIX (http://lmgtfy.com/?q=POSIX+timezones), to configute the container to have your local time.

-e TZ=Europe/Berlin

The user credentials for the first WEB Device in your FHEM config. Without that the Healthcheck will show Unhealthy if you use basic auth in FHEM!

-e HEALTHCHECKCREDENTIALS=user:password

The ConfigType you want to use, default is "fhem.cfg", use "configDB" if you want to start FHEM with ConfigDB instead of fhem.cfg file! CAUTION: An initial start of these container with configDB isn't intended in my routines. Terefore if you want to use it, migrate from fhem.cfg or take care to follow the ADVICES below. Furthermore, if you are using configDB, Healthcheck can't determine your FHEM Web port and if you are using https from your fhem.cfg file, therefore also specify them by the following variables.

-e CONFIGTYPE=configDB
-e HEALTHCHECK_PORT=8083
-e HEALTHCHECK_HTTPS=true

ADVICES:

Keep the folowing lines in your configuration or add them if you are migrating from an existing config.

attr global logfile /opt/fhem/log/fhem-%Y-%m.log
attr global modpath /opt/fhem
attr global nofork 0
attr global pidfilename /opt/fhem/log/fhem.pid
attr global updateInBackground 1
define telnetPort telnet 7072 global

And furthermore

Make sure to always use absolout paths in your configuration beginning with /opt/fhem/ not with ./ !


Commands:

Show Running containers:
docker ps
Attach shell to container:
docker exec -it fhem-docker /bin/bash
View live log output of container and FHEM:
docker logs -f fhem-docker

WebGUI of FHEM:

http://ipaddress:8083

Donate


About

Docker Container for FHEM House-Automation-System - Full install with all dependencies

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published