项目作者: stormmurdoc

项目描述 :
FHEM docker home automation stack
高级语言: Perl
项目地址: git://github.com/stormmurdoc/fhemdocker.git
创建时间: 2020-01-24T22:41:31Z
项目社区:https://github.com/stormmurdoc/fhemdocker

开源协议:

下载


Home Automation Stack

"FHEM GUI"
The stack contains everything to run FHEM on a Docker host. Mosquitto is used as message broker. SIRI functions are realized with the help of a homebridge container. The complete stack runs on x86 as well as arm architectures. It is very easy to clone its complete productive environment and has a simple way to build a test system.

Table of content

Todo

  • Mosquitto user-/groupid problem
  • Grafana integration

Requirements

  • docker
  • docker-compose

Installation raspberrypi

Raspian Download

Download the image of your choise: Raspian Download
Unzip the image and install it with:

  1. sudo dd bs=4M if=2021-10-30-raspios-bullseye-armhf-lite.img of=/dev/mmcblk0 conv=fsync
  2. sync

Eject the card and insert it again to mount the filesystems boot & rootfs.
Touch a blank file ssh to enable sshd daemon on first boot.

  1. sudo touch /media/boot/ssh
  2. sync
  3. umount /media/boot
  4. umount /medua/rootfs

Eject the card and insert into your raspberrpi. After that power on the rpi and login with
the known user pi and password raspberry.

  1. ssh pi@raspberrypi4

Change your password with the command

  1. pi@raspberrypi:~ $ passwd
  2. Changing password for pi.
  3. Current password:
  4. New password:
  5. Retype new password:
  6. passwd: password updated successfully
  7. pi@raspberrypi:~ $

System Update

  1. sudo apt-get update
  2. sudo apt-get dist-upgrade

Set timezone

  1. sudo dpkg-reconfigure tzdata

Raspberry Config

1) Expand the root filesystem (A1 / Advanced Options)
2) Update raspi-config

  1. sudo raspi-config
  2. sudo reboot

Disable swap

  1. sudo dphys-swapfile swapoff && \
  2. sudo dphys-swapfile uninstall && \
  3. sudo systemctl disable dphys-swapfile

Install additional packages

  1. sudo apt-get install wget git apt-transport-https vim telnet zsh zsh-autosuggestions zsh-syntax-highlighting ntp ksh logwatch

Configure ntpd daemon

  1. sudo vi /etc/ntp.conf

Disable all pool server and add your local time server

  1. server 192.168.1.1

Install oh-my-zsh

  1. sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Install log2ram (/var/log 2 ram)

github page log2ram

  1. echo "deb http://packages.azlux.fr/debian/ buster main" | sudo tee /etc/apt/sources.list.d/azlux.list
  2. wget -qO - https://azlux.fr/repo.gpg.key | sudo apt-key add -
  3. apt update
  4. apt install log2ram

Setup ssh key for user

  1. ssh-keygen -t rsa -b 8192

Install docker & docker-compose

After installation put your user pi into the docker group.

  1. curl -sSL https://get.docker.com | sh
  2. sudo systemctl enable docker
  3. sudo systemctl start docker
  4. sudo apt-get install docker docker-compose
  5. sudo usermod -aG docker pi
  6. sudo reboot

git repository export and start all container

Note: Please run the startup.sh script after cloning.

  1. cd
  2. git clone https://github.com/stormmurdoc/fhemdocker.git
  3. cd fhemdocker
  4. ./startup.sh

Access the application

FHEM

FHEM tmux session inside the container

"fhemtmux"

http://localhost:80

influxdb

Further details about the influxdb module can be found here.
FHEM Wiki influxdb

Container

Tasmota Admin

"tasmotaadmin"

http://localhost:8081

Tasmota Compiler

"tasmotacompiler"

http://localhost:8082

Homebridge

Default User: admin
Default Passwort: admin

"homebridge"

http://localhost:8080

Portainer

"portainer"

http://localhost:9000

Deconz

deCONZ Image Container Integration

Configuring Raspbian for RaspBee

Raspbian defaults Bluetooth to /dev/ttyAMA0 and configures a login shell over serial (tty). You must disable the tty login shell and enable the serial port hardware, and swap Bluetooth to /dev/S0, to allow RaspBee to work properly under Docker.

To disable the login shell over serial and enable the serial port hardware:

1) sudo raspi-config
1) Select Interfacing Options
1) Select Serial
1) “Would you like a login shell to be accessible over serial?” Select No
1) “Would you like the serial port hardware to be enabled?” Select Yes
1) Exit raspi-config and reboot
To swap Bluetooth to /dev/S0 (moving RaspBee to /dev/ttyAMA0), run the following command and then reboot:

echo 'dtoverlay=miniuart-bt' | sudo tee -a /boot/config.txt

This will exchange the UART and the Mini-UART so the Mini-UART is connected to the bluetooth and the UART to the GPIO pins.

On Raspberry Pi 4 verify that file /boot/config.txt does NOT contain a line “enable_uart=0”. If the line exists remove or comment (#) this line.

After running the above command and rebooting, RaspBee should be available at /dev/ttyAMA0.

Watchtower

This container automatically update all running container within a given time interval.

https://containrrr.github.io/watchtower/

ctop

Description

ctop is a commandline monitoring tool for linux containers

"ctop"

Installation

ctop is available in AUR, so you can install it using AUR helpers, such as YaY, in Arch Linux and its variants such as Antergos and Manjaro Linux.

Installation Linux

x86 Platform

  1. sudo wget https://github.com/bcicen/ctop/releases/download/v0.7.5/ctop-0.7.5-linux-amd64 -O /usr/local/bin/ctop
  2. sudo chmod +x /usr/local/bin/ctop

arm Platform

  1. sudo wget https://github.com/bcicen/ctop/releases/download/v0.7.5/ctop-0.7.5-linux-arm -O /usr/local/bin/ctop
  2. sudo chmod +x /usr/local/bin/ctop

Known Issues

FHEM website not reachable

“Error nginx”

If you’re not able to login. Please check the permissons of the .htpasswd file in

  1. ./fhemdocker/reverseproxy/config/.htpasswd

Set the right to 644 with

  1. chmod 644 ./fhemdocker/reverseproxy/config/.htpasswd

Accessing the docker container via remote

If you want to commit a FHEM command via the local telnet daemon you can use the script fcmd.sh.
Note: Please change the hostname accordingly.

  1. Username: pi
  2. Hostname: raspberrypi4 (replace it with your hostname)
  3. fcmd.sh <FHEM Command>

Contributing to fhemdocker

Contributions are encouraged and welcome!