Page 1 of 7

Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 26 February 2021 13:44
by Stormryder
I had Domoticz installed as a package from Jadahl, but because development stopped and DSM 7 is coming I needed an alternative.
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
(press Y when asked Yes or No and press enter)

Code: Select all

apt install python-requests
(press Y when asked Yes or No and press enter)
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
This will show you which version is default e.g. "Python 2.7.8"
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 
This will show if there are already alternative versions for Python available, probably will show; "update-alternatives: error: no alternatives for 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
After this command you will see a message like; "update-alternatives: using /usr/bin/python3.7 to provide /usr/bin/python (python) in auto mode"
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

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 26 February 2021 14:16
by waltervl
Thanky you, highly appreciated.

I made also a reference to this topic in the Docker Wiki https://www.domoticz.com/wiki/Docker

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Saturday 27 February 2021 11:53
by GJKNL
Works great! Thanks. Zwave and rfx recognized. How to use the Conbee2 (deConz) with domoticz in Docker-container?

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Sunday 28 February 2021 9:15
by Thorgal789
GJKNL wrote: ↑Saturday 27 February 2021 11:53 Works great! Thanks. Zwave and rfx recognized. How to use the Conbee2 (deConz) with domoticz in Docker-container?
I don't know Docker, but probably will be better to use another docker just for deconz ? https://github.com/marthoc/docker-deconz
Take care, never update the firwmare using docker.

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Sunday 28 February 2021 12:24
by JonyBCN
Stormryder wrote: ↑Friday 26 February 2021 13:44
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.
With all due respect ... Doesn't that keep making us dependent on Jadahl? That is, with DSM7 or in the not so distant future, what will happen to USB support?

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 05 March 2021 19:20
by Stormryder
JonyBCN wrote: ↑Sunday 28 February 2021 12:24
With all due respect ... Doesn't that keep making us dependent on Jadahl? That is, with DSM7 or in the not so distant future, what will happen to USB support?
You are correct, but I do not have an alternative at this moment. Please fill me in if you have one.

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 05 March 2021 20:26
by jumbotroll
Stormryder wrote: ↑Friday 05 March 2021 19:20
JonyBCN wrote: ↑Sunday 28 February 2021 12:24
With all due respect ... Doesn't that keep making us dependent on Jadahl? That is, with DSM7 or in the not so distant future, what will happen to USB support?
You are correct, but I do not have an alternative at this moment. Please fill me in if you have one.
I promise nothing, but if synology releases the Linux kernel source code for DSM 7, it is possible I will build the USBSerialdriver packages for DSM 7.

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 05 March 2021 20:40
by JackD
That would be great........ thanks....
jumbotroll wrote: ↑Friday 05 March 2021 20:26
Stormryder wrote: ↑Friday 05 March 2021 19:20
JonyBCN wrote: ↑Sunday 28 February 2021 12:24
With all due respect ... Doesn't that keep making us dependent on Jadahl? That is, with DSM7 or in the not so distant future, what will happen to USB support?
You are correct, but I do not have an alternative at this moment. Please fill me in if you have one.
I promise nothing, but if synology releases the Linux kernel source code for DSM 7, it is possible I will build the USBSerialdriver packages for DSM 7.

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Saturday 06 March 2021 8:34
by bce626
question, if the domoticz container update, do you also need to re-install python? because the original domoticz/domoticz does not have python standard in it

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 26 March 2021 15:53
by bouwnty
Great, works perfect!

One question, though:

How do I disable logging in the Docker container as the log is already available inside Domoticz?

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 26 March 2021 16:34
by waltervl
According documentation: Logging
Logging is disabled by default, and you can see the interna logs via the web gui. When you enable logging, keep in mind that the log file can become quite large. Do not leave this enabled when not needed.

Else you should remove the Environment (Milieu) Value LOG_PATH if present.

LOG_PATH=/opt/domoticz/userdata/domoticz.log

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 26 March 2021 16:56
by EddyG
Stormryder wrote: ↑Friday 26 February 2021 13:44 Tab 'Terminal' -> Make and click the 'Bash' tab
Run the following commands (after each command, press enter):
apt update
apt install curl
apt install python (press Y when asked Yes or No and press enter)
apt install python-requests (press Y when asked Yes or No and press enter)
If you need any other things installed for you scripts, this is the way to go.
Nice manual. :)
Keep in mind that when ever you update the container, you have to do this again.

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 26 March 2021 17:26
by bouwnty
waltervl wrote: ↑Friday 26 March 2021 16:34 According documentation: Logging
Logging is disabled by default, and you can see the interna logs via the web gui. When you enable logging, keep in mind that the log file can become quite large. Do not leave this enabled when not needed.

Else you should remove the Environment (Milieu) Value LOG_PATH if present.

LOG_PATH=/opt/domoticz/userdata/domoticz.log
The value LOG_PATH is emtpy, still log is showing in Log tab in container Details in Docker in DiskStation. Removing the value doesn't do anything.

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 26 March 2021 19:26
by waltervl
Ok, this is something special in Synology docker. The same as Python not available while on my docker on a Ubuntu machine I have Python...

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Friday 02 April 2021 14:55
by Gravityz
got this thread from Waltervl

question, can i install the jadahl usb driver package while i also have the current jadahl domoticz package installed.

eg will my current version still work.
if it does it will give me some time to install the docker image without the presure of getting it to work.

if things fail i want to be able to just stop the docker image, start the domoticz package and everything should be running the old way(of course i loose some time)

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Sunday 04 April 2021 11:33
by gerbenvanasselt
Gravityz wrote:got this thread from Waltervl

question, can i install the jadahl usb driver package while i also have the current jadahl domoticz package installed.

eg will my current version still work.
if it does it will give me some time to install the docker image without the presure of getting it to work.

if things fail i want to be able to just stop the docker image, start the domoticz package and everything should be running the old way(of course i loose some time)
Good question I am in the same situation, can anybody answer Gravity's question?

Verstuurd vanaf mijn Pixel 5 met Tapatalk


Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Sunday 04 April 2021 16:12
by EddyG
Gravityz wrote: ↑Friday 02 April 2021 14:55 got this thread from Waltervl

question, can i install the jadahl usb driver package while i also have the current jadahl domoticz package installed.

eg will my current version still work.
if it does it will give me some time to install the docker image without the presure of getting it to work.

if things fail i want to be able to just stop the docker image, start the domoticz package and everything should be running the old way(of course i loose some time)
First you could run the jadahl domoticz and the docker domoticz side by side if you use other ports.
Do you want the usb driver only in the container or in DSM?
I think if you install it in DSM you might be abke to use it in the container too.
Just try, can't harm.

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Sunday 04 April 2021 16:51
by Gravityz
Hi
the question was if the usb drivers are interfering with the jadahl package(which also has the drivers installed)

i can run both version side by side(already have tried it without enabling zwave )

the problem you then have is you get a lot of id errors in the current domoticz version so that is not advised

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Wednesday 14 April 2021 0:31
by laco
My domoticz runs in dockers. Everything works perfectly. Just writing to sql mariadb outside the container doesn't work for me.
I have created a script: and after moving to the dock, it does not send me data to the database now. The log prints an error:

Code: Select all

2021-04-14 00:22:00.543 Status: dzVents: Debug: TMEP_0.201909201700: Executing Command: echo " INSERT INTO tme(kdy, teplota, vlhkost)VALUES (NOW(), -0.3, 97.0) " | mysql -v -u domo -pDomoticz-63 TMEP;
2021-04-14 00:22:00.550 Status: dzVents: Debug: TMEP_0.201909201700: ReturnCode: 127
2021-04-14 00:22:00.550 commandOutput:
2021-04-14 00:22:00.550 Error: dzVents: Error: (3.1.6) TMEP_0.201909201700: ReturnCode: 127
I described it in this forum: viewtopic.php?f=28&t=29426

Can anyone help me?

Re: Synology - guide to switch from Jadahl package to official docker (domoticz-docker)

Posted: Sunday 18 April 2021 8:40
by RogerSch
Gravityz wrote: ↑Sunday 04 April 2021 16:51 Hi
the question was if the usb drivers are interfering with the jadahl package(which also has the drivers installed)

i can run both version side by side(already have tried it without enabling zwave )

the problem you then have is you get a lot of id errors in the current domoticz version so that is not advised
This is indeed I also want to know... Before I start to work on switching to the Docker image I must have an option to quickly revert back to my current working setup.

And after some quick googling it turn out that USB drivers created by Jadahl are essential (even Home Assistant setups running in a Docker container). So it hopefully they also become available in DSM 7.