Page 1 of 1
how to create new dzVents script with templates
Posted: Sunday 11 April 2021 21:36
by Gravityz
on my current domoticz setup i can create a new dzVents script, select a template like All or minimal and i get a script with that template.
on my new setup however when i select a template like All, nothing is filled in.
i checked my directory and /volume1/docker/domoticz/scripts/dzVents/examples/templates has all the templates.
am i missing something?
Re: how to create new dzVents script with templates
Posted: Sunday 11 April 2021 21:50
by waaren
Gravityz wrote: Sunday 11 April 2021 21:36
on my new setup however when i select a template like All, nothing is filled in.
am i missing something?
In recent domoticz versions, Events.js does not look in scripts/dzVents/examples/templates but in scripts/templates. Don't remember when this changed.
Re: how to create new dzVents script with templates
Posted: Sunday 11 April 2021 22:19
by Gravityz
ok, i checked and i have them now in both places.
stopped and started the container but they are still not filled in
Re: how to create new dzVents script with templates
Posted: Sunday 11 April 2021 22:32
by waaren
Gravityz wrote: Sunday 11 April 2021 22:19
ok, i checked and i have them now in both places.
I checked and the templates were always taken from scripts/templates. The ones in scripts/dzVents/examples/templates are unneeded duplicates and will be removed in one of the next builds.
stopped and started the container but they are still not filled in
Probably something similar as the other docker issue (the one where dockorized domoticz cannot find JSON.lua inside the script subdirectory)
Re: how to create new dzVents script with templates
Posted: Sunday 11 April 2021 23:04
by Gravityz
ok. thanks.
Re: how to create new dzVents script with templates
Posted: Monday 12 April 2021 17:37
by Gravityz
when mapping /opt/domoticz/userdata to an external volume like volume1/docker/domoticz it appears that default paths are overruled.
this time i used all the template files inside the container
copied /opt/domoticz/scripts/templates outside the container to path /volume1/docker/domoticz/scripts/templates
when i select a new script(either lua or dzVents) and select a template it shows up.
So i can confirm that by mapping the /opt/domoticz/userdata to outside path(/volume1/docker/domoticz)
the default path /opt/domoticz/scripts is overruled when external mapping is used and domoticz only searches for the scripts in /volume1/docker/domoticz/scripts/templates
looks like the same problem as with JSON.lua
the fix for JSON files in de lua directory(can we make this permanent in newer builds)
move/copy all the JSON related files from /opt/domoticz/scripts/lua to /opt/domoticz/dzVents/runtime
the fix for the template scripts(do not think we can fix this inside the docker image)
using the docker cp command to copy /opt/domoticz/scripts/templates to /volume1/docker/domoticz/scripts/templates
docker cp containerid:/opt/domoticz/scripts/templates /volume1/docker/domoticz/scripts/templates
Re: how to create new dzVents script with templates
Posted: Tuesday 10 January 2023 14:02
by mgugu
Hi all
Gravityz wrote: Sunday 11 April 2021 21:36
on my current domoticz setup i can create a new dzVents script, select a template like All or minimal and i get a script with that template.
on my new setup however when i select a template like All, nothing is filled in.
i checked my directory and /volume1/docker/domoticz/scripts/dzVents/examples/templates has all the templates.
am i missing something?
I just started using docker for a new domoticz instance and it seems that issues above are still unsolved.
Re: how to create new dzVents script with templates
Posted: Tuesday 10 January 2023 15:13
by Gravityz
yes and it will probably stay unsolved.
when you map to external storage the container is using that external storage and is also looking for the templates in that location.
my solution to copy the templates to the external storage only needs to be performed once and after that the problem is gone
i recently checked and the current templates are stil the same as 2 years ago so not problem with outdated templates
if you want to solve the problem you can do so by scripting.
with recent domoticz versions the container will start a customstart.sh script when it finds this script.
in this script you could put this command to copy the files
like i said, the problem can be solved but since the external mapping path is different for each setup it might be easier to just manually copy the files and be done with it.
Re: how to create new dzVents script with templates
Posted: Tuesday 10 January 2023 15:34
by mgugu
Gravityz wrote: Tuesday 10 January 2023 15:13
yes and it will probably stay unsolved.
when you map to external storage the container is using that external storage and is also looking for the templates in that location.
my solution to copy the templates to the external storage only needs to be performed once and after that the problem is gone
i recently checked and the current templates are stil the same as 2 years ago so not problem with outdated templates
if you want to solve the problem you can do so by scripting.
with recent domoticz versions the container will start a customstart.sh script when it finds this script.
in this script you could put this command to copy the files
like i said, the problem can be solved but since the external mapping path is different for each setup it might be easier to just manually copy the files and be done with it.
OK for templates, but I imagine the same procedure does not work for live folders (generated_scripts, data,..).
Could you please provide me with your customstart.sh script, I will adapt it.
I imagine docker/domoticz to be simpler to install but it looks like to be the contrary

Re: how to create new dzVents script with templates
Posted: Tuesday 10 January 2023 16:24
by Gravityz
it should work for the generated _scripts data and all the directories which are not created on the first run also
the same case, icreated all those directories once so i did not get an error when installing the first time.
i am not sure if they fixed this but if not you can but all those commands inside the custmostart.sh file as well
the script is run every time prior to starting up the container
if a certain file is not visible inside the container it does all the actions you want and create that file
on the second time you start the container that file will be there and all commands will be skipped.
i adjusted the file for you so you have an idea who it works.
mapping of the external directory needs to be
Code: Select all
#!/bin/bash
if [ -f /opt/domoticz/FIRSTRUN ]; then
true
else
echo 'updating packages'
apt-get -qq update
echo 'installing mosquitto clients'
apt-get -y install mosquitto-clients
echo 'installing iputils-ping'
apt-get -y install iputils-ping
echo 'creating FIRSTRUN file so script can check on next run'
touch /opt/domoticz/FIRSTRUN
echo 'copying templates to external mapped storage /volume1/domoticz/scripts/templates
cp -r /opt/domoticz/scripts/templates /opt/domoticz/userdata/scripts
cd /opt/domoticz || return
fi
Re: how to create new dzVents script with templates
Posted: Tuesday 10 January 2023 16:43
by mgugu
Thank you @Gravitiz.
That solves the templates question
Something strange is that I can access "generated_scripts" but not "data" which belong to same directory.
Re: how to create new dzVents script with templates
Posted: Tuesday 10 January 2023 17:40
by Gravityz
i checked with my setup
all the directories have user rights 0755 with user root
Re: how to create new dzVents script with templates
Posted: Tuesday 10 January 2023 17:50
by mgugu
Gravityz wrote: Tuesday 10 January 2023 17:40
i checked with my setup
all the directories have user rights 0755 with user root
Same here