I found the official docker (https://hub.docker.com/r/domoticz/domoticz) and wanted to switch, keeping my entire domotica setup working.
After several days everything is working; keeping my entire setup (with scripts, P1 meter, Zigbee2MQTT and Homebridge setup working YEAH!!)
Because it took me waaaaaaaay to long to figure everything out I made this post as a guide for anyone looking to make the same switch.
And probably as a reference for myself when I manage to mess things up after a few weeks of tweaking and fooling around (trying make things even better )
First backup your DB, plugins and scripts
- Create a backup of the Database of your current Domoticz setup (settings->settings->Tab 'Backup/restore'-> Backup and save that file local)
- Copy the 'plugin' folder and the 'scripts' folder of you current Domoticz setup and save them local
Installing domoticz/domoticz-docker (with the GUI package of Synology)
Install domoticz/domoticz-docker (official Domoricz container)
Press Start and configure it like this:
- Check 'run as admin' (or something similar, in dutch it is 'Uitvoeren met hoge machtiging)
- Click 'advanced settings'
- Check 'Automatic restart'
- Tab 'Volume' -> 'add folder' and select (or create and select) 'docker/domoticz', then 'connect path' -> /opt/domoticz/userdata
- Tab 'Port settings' (SO DO NOT GO TO NETWORK JUST YET, BUT FIRST TO PORT SETTINGS), adjust the local port and container port (I change local port from automatic to the same port as the container port).
- Tab 'Network' -> Check 'Use same network as Docker Host'
- Tab 'Environment' (THIS IS NOT VISIBLE, YOU HAVE TO RESIZE THE WINDOW, DRAG THE RIGHT SIDE TO THE RIGHT IT WILL APPEAR) -> change the ports to the port settings you used in tab 'port settings'. I do not know if this is needed, but it doesn't hurt and my setup works .
Now start the container, Domoticz can be reached with http://<IP of the NAS>:<port you chose, like 8080>
Restoring plugins and Database
As you can see there is a folder visible in File Station (docker/domoticz), copy the plugin and scripts folder you saved locally to this folder.
Then go to Domoticz and go to settings->settings->Tab 'Backup/restore'-> Restore and restore the backup file you saved local (<name>.db)
Restart the container when the backup is done (mine did this automatically)
Local access without credentials
Switching to docker broke my settings to connect to Domoticz from inside the LAN without credentials. I had this setup with my LAN-ip (192.168.1.*). But the container doesn't see incoming traffic from the LAN, only from the local host (127.0.0.1). So make sure you add this:
Go to settings->settings->system and make sure you add 127.0.0.* to Local Networks. Mine only had 192.168.1.*, now it has 192.168.1.*;127.0.0.*
If you have any scripts that use the IP of domoticz, you MIGHT need to change them as well. (so from 192.168... to 127.0.0.1)
Python and Curl plugins/scripts
I ran into problems with my existing python and curl scripts which I use for getting data from my PV (solar panels) etc.. I used these in my old setup in the Domoticz package, but noticed they didn't work in the docker setup. I found out that Python and Curl are not installed inside the container, so you need to do that (for now, maybe the docker image of Domoticz will adopt this in the future).
Go to 'Details' of the Docker container of Domoticz
Tab 'Terminal' -> Make and click the 'Bash' tab
Run the following commands (after each command, press enter):
Code: Select all
apt update
Code: Select all
apt install curl
Code: Select all
apt install python
Code: Select all
apt install python-requests
If you need any other things installed for you scripts, this is the way to go.
Check if default python version is the one needed, if not change it (added Feb. 5 2022)
I found out that even though Python is installed, I would still get error messages in the log, regarding python.
Found out the default python version the docker-image uses is Python2.7xxx (or something similar) while my scripts/Domoticz need Python3.7.
Follow these steps to check and change if needed;
Tab 'Terminal' -> Make and click the 'Bash' tab
Run the following commands (after each command, press enter):
Code: Select all
python -V
If this is the version you need, than there is no need to change is, but of so; continue to the next step
Code: Select all
update-alternatives --list python
Next if you want to make Python 3.7 default use the following command (change the version number to which number you want default)
Code: Select all
update-alternatives --install /usr/bin/python python /usr/bin/python 3.7 1
Run the command to check the version again (python -V) and you will see Python 3.7 is default now.
Thanks to https://linuxconfig.org/how-to-change-f ... ian-linux/ for providing this tutorial.
USB port, for e.g. P1 meter and/or Zigbee2MQTT
I ran into problems with my P1 meter (USB) and Zigbee2MQTT (USB) after a restart of my NAS. The USB-ports I used, like ttyUSB0 and ttyUSB1 were not created, so the P1 meter was not updated in Domoticz. And Zigbee2MQTT didn't start because the USB-stick was unavailable.
This took way to long to figure out, but I managed to track it down; the USB drivers of these devices are not installed.
After installing the Jadahl ‘USB driver package’ http://www.jadahl.com/# (download the 6.1 or 6.2 version corresponding with the DSM installed on your NAS) and install this manually in Synology Package center. The USB drivers are installed automatically and ttyUSB0 and ttyUSB1 (or something similar) are created again. P1 meter works and Zigbee2MQTT starts and works again.
Updating to 2022.01 (added Feb. 05 2022)
Updating the Domoticz-docker to version 2022.01 works great when using the following steps (thanks to @Gravityz):
From the synology user interface go to docker-container and select the domoticz container
Stop it and rename it to "domoticz-old"
Next go to Register and search the "domoticz/domoticz" image
Choose 'Latest' (for latest Beta or choose specific version in dropdown; 2022.01) and download it. This will replace the current image with the new, updated one (version 2022.01)
When download is finished go back to the old container domoticz-old and right click to get options from this old container
Choose 'settings duplicate' and name the new container 'Domoticz' and finally start it.
Important after updating; you need to redo the 'Python and Curl plugins/scripts' part of this tutorial. Note that curl is already included in version 20222.01
Initial installation in official Domoticz wiki has been updated with 'Dockerized Domoticz', this may help for those that find above steps to complex or not working.
https://www.domoticz.com/wiki/Synology