Migration Domoticz to Docker

Sometime ago I started using domoticz on my first RPI ( zero w). The only reason that I used it was to keep track of my smart meter (p1). It ran for some time without any issues but suddenly it decided to crash all the time ( the pi that is). Obviously a SDcard that is committing suicide.. Over the years I also bought a RPI 3b which is used for my local Pihole/DHCP setup. So I figured that it would be great to migrate the domoticz to this same system.

One extra challenge ( so I thought ), I wanted it to run dockerized. I expected to be busy for one hour or so but actually it took only 15 minutes! (writing this post takes longer) Here is what I’ve done:

  • Install docker / compose on your rpi ( already did that. See here for notes: https://phoenixnap.com/kb/docker-on-raspberry-pi)
  • Create docker compose for the domoticz instance ( see: https://hub.docker.com/r/domoticz/domoticz and scroll to Usage with docker-compose)
  • Bring the original RPI W down and read the latest domotics backup from the SD Card (when using windows, you can use diskinternals linux reader for that)
  • start the domoticz container ( /home/pi/data/domoticz/docker-compose up -d)
  • login and import the database from step 3
  • docker-compose down
  • shutdown the rpi
  • connect the P1 sensor to the USB drive
  • Reboot the system and find out which device the P1 sensor is mapped to (look in /dev/serial/by-id/.) and map it to original device. This can be done in the compose file
  • start the domoticz container again
  • Login and everything should be up and running again

The docker compose file I used:

version: '3.3'

services:
  domoticz:
    image: domoticz/domoticz
    container_name: domoticz
    restart: unless-stopped
    # Pass devices to container
    devices:
      - "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AH1MBWKQ-if00-port0:/dev/ttyUSB0"
    ports:
      - "8080:8080"
    volumes:
      - /mnt/usb/domoticz/config/:/opt/domoticz/userdata
      - /mnt/usb/domoticz/logs/:/opt/domoticz/userdata/logs
    environment:
      - TZ=Europe/Amsterdam
      - LOG_PATH=/opt/domoticz/userdata/logsdomoticz.log

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.