docker-ha/README.md

76 lines
2.5 KiB
Markdown

# Home Assistant docker compose
This compose sets up Home Assistant and services used by it
## hass
Home assistant container.
The image is specially built with the following features
- Home Assistant doesn't run as root
- /config is a volume
- /home/hass/.local/lib is a volume to make pip cache persistent between rebuilds
- Port 8123 is exposed by default
- Added a healthcheck
- If the env variable WAITDB_HOST is set Home Assistant doesn't start until the mysql database at that host with username WAITDB_USER and password WAITDB_PASS is available.
Available on all networks.
Make sure to select all network adapters as active under Configuration->General->Network so `discovery` works.
To update:
```bash
> docker-compose build --pull hass
> docker-compose down hass
> docker-compose up -d hass
```
## db
Mariadb for Home Assistant use.
## dbadmin
PHPMyAdmin container for tweaking the database if necessary.
Start when needed.
## mqtt
Mosquitto server.
Exposed to IOT network (which is also accessible from LAN thanks to its netmask).
## influx
Storage for Home Assistant sensor data
## grafana
For pretty plotting of data from `influx`
## deconz
Deconz container
`/dev/conbee` is created on the host by a udev rule in `/etc/udev/rules.d/10-conbee-local.rules`:
```
ACTION="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", SYMLINK+="conbee"
```
VNC is activated with password `secret`. This is not exposed outside of the docker internal network, though (can be connected to with e.g. a guacamole container).
A simple healthcheck is added for stability.
## plejd
plejd2mqtt container
https://github.com/thomasloven/plejd2mqtt - a standalone version of a Home Assistant add-on which connects plejd via bluetooth to MQTT.
Access to the bluetooth bus is required through `/var/run/dbus`.
## Mobile
pajikos/sms-gammu-gateway exposes GSM modem functionality via REST.
`/dev/gsmmodem` is created on the host by a udev rule in `/etc/udev/rules.d/999-gsm-modem.rules`:
```
ACTION=="add", ATTRS{idVendor}=="2001", ATTRS{idProduct}=="ac01", RUN+="/usr/sbin/usb_modeswitch -K -v 2001 -p ac01 -V 2001 -P 7e3d"
SUBSYSTEM=="tty", ACTION=="add", ENV{ID_VENDOR_ID}=="2001", ENV{ID_MODEL_ID}=="7e3d", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="gsmmodem"
```
This requires [usb-modeswitch](https://packages.debian.org/bullseye/usb-modeswitch) to be installed on the host, and the exact commands vary greatly from device to device. The above works for my D-Link DWM222, but may or may not work with your D-Link DWM222.
Health check added for stability