Home Assistant on Synology Docker
My Raspberry Pi's SD card died for the second time, so I stopped fighting it and moved Home Assistant onto the NAS, which is on 24 hours a day anyway. The official Docker image means I don't have to maintain a Python environment on DSM. This is what I run on a DS918+ with the Docker package on DSM 6.1.
The one twist compared to most containers is networking. Home Assistant discovers devices with multicast (mDNS, SSDP), which doesn't cross Docker's bridge network, so the container has to run in host mode. You need Docker and SSH enabled, port 8123 free, and optionally a USB Z-Wave or Zigbee stick.
Config folder
sudo mkdir -p /volume1/docker/homeassistant
Everything Home Assistant writes, including configuration.yaml, the SQLite history database and the .storage directory, goes here.
Launch with host networking
In the Docker GUI: Registry → search homeassistant/home-assistant → Download (tag latest, which is 0.60 at the moment). Then Image → Launch → Advanced Settings:
- General: tick Enable auto-restart.
- Volume: Add Folder
docker/homeassistant→ Mount path/config. - Network: tick "Use the same network as Docker Host".
- Environment: add
TZ=Europe/Berlin(or your zone).
The CLI equivalent, which I prefer because it can be re-run:
sudo docker run -d --name homeassistant \
--restart unless-stopped \
--net=host \
-e TZ=Europe/Berlin \
-v /volume1/docker/homeassistant:/config \
homeassistant/home-assistant:latest
With --net=host no port mapping is needed; the container listens on the NAS IP directly.
First login and a minimal config
Open http://nas-ip:8123. Home Assistant will have created a default configuration.yaml. Edit it with any editor that reaches the share (I map \\nas\docker from my PC and use Notepad++). A minimal example with a password on the web interface:
homeassistant:
name: Home
latitude: 52.52
longitude: 13.40
elevation: 40
unit_system: metric
time_zone: Europe/Berlin
http:
api_password: !secret http_password
base_url: https://ha.example.com
frontend:
config:
history:
logbook:
discovery:
Put http_password: something-long in secrets.yaml next to it. Restart the container after every configuration change:
sudo docker restart homeassistant
USB stick passthrough
If you use an Aeotec Z-Stick or a ConBee, find it on the NAS:
ls -l /dev/ttyACM* /dev/ttyUSB*
The Docker GUI cannot add devices, so recreate the container from the CLI with --device /dev/ttyACM0:/dev/ttyACM0 added. Then configure it:
zwave:
usb_path: /dev/ttyACM0
DSM may renumber the device after a reboot if several USB devices are attached; using a udev-style path under /dev/serial/by-id/ is not available on DSM, so keep the stick alone on its port.
Reverse proxy
Control Panel → Application Portal → Reverse Proxy → Create: Source HTTPS ha.example.com:443, Destination HTTP localhost:8123. Add the WebSocket custom headers (Upgrade and Connection), otherwise the frontend will show data once and never update. Set base_url in the http: section as shown above so notifications and the mobile app build correct links.
Is it alive?
sudo docker logs --tail 30 homeassistant
curl -s -o /dev/null -w '%{http_code}\n' http://localhost:8123/
The log should end with lines like Home Assistant initialized in 12.34s and the curl should print 200 (or 401 if the API password is set, which is also fine). In the web interface, open Configuration → General → Check Config; it must say "Configuration valid". Devices such as Chromecasts and Hue bridges should appear under Configuration → Integrations within a minute if host networking is working.
If it misbehaves
- No devices are discovered and the log says
Could not start discovery: the container is on the bridge network. Recreate it with--net=host; there is no way to switch an existing container. Error: Address already in useorOSError: [Errno 98]on port 8123: another container or a previous Home Assistant instance still runs in host mode.docker psand stop it.- The web page loads but shows "Unable to connect to Home Assistant" behind the proxy: WebSocket headers are missing in the reverse proxy rule.
PermissionError: [Errno 13] Permission denied: '/config/home-assistant_v2.db': the image runs as root, so this only happens if the share has an ACL denying root; reset the folder permissions from File Station.
Upgrading is a docker pull and a recreate. Back up /volume1/docker/homeassistant before you do it, because point releases sometimes break configs.