how to create new dzVents script with templates
Moderator: leecollings
-
Gravityz
- Posts: 652
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2025.1
- Location: Netherlands
- Contact:
how to create new dzVents script with templates
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?
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?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: how to create new dzVents script with templates
In recent domoticz versions, Events.js does not look in scripts/dzVents/examples/templates but in scripts/templates. Don't remember when this changed.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?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
Gravityz
- Posts: 652
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2025.1
- Location: Netherlands
- Contact:
Re: how to create new dzVents script with templates
ok, i checked and i have them now in both places.
stopped and started the container but they are still not filled in
stopped and started the container but they are still not filled in
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: how to create new dzVents script with templates
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.
Probably something similar as the other docker issue (the one where dockorized domoticz cannot find JSON.lua inside the script subdirectory)stopped and started the container but they are still not filled in
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
Gravityz
- Posts: 652
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2025.1
- Location: Netherlands
- Contact:
Re: how to create new dzVents script with templates
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
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
-
mgugu
- Posts: 226
- Joined: Friday 04 November 2016 12:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: France
- Contact:
Re: how to create new dzVents script with templates
Hi all
I just started using docker for a new domoticz instance and it seems that issues above are still unsolved.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?
-
Gravityz
- Posts: 652
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2025.1
- Location: Netherlands
- Contact:
Re: how to create new dzVents script with templates
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.
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.
-
mgugu
- Posts: 226
- Joined: Friday 04 November 2016 12:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: France
- Contact:
Re: how to create new dzVents script with templates
OK for templates, but I imagine the same procedure does not work for live folders (generated_scripts, data,..).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.
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
-
Gravityz
- Posts: 652
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2025.1
- Location: Netherlands
- Contact:
Re: how to create new dzVents script with templates
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
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-
mgugu
- Posts: 226
- Joined: Friday 04 November 2016 12:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: France
- Contact:
Re: how to create new dzVents script with templates
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.
That solves the templates question
Something strange is that I can access "generated_scripts" but not "data" which belong to same directory.
-
Gravityz
- Posts: 652
- Joined: Wednesday 16 December 2015 19:13
- Target OS: NAS (Synology & others)
- Domoticz version: 2025.1
- Location: Netherlands
- Contact:
Re: how to create new dzVents script with templates
i checked with my setup
all the directories have user rights 0755 with user root
all the directories have user rights 0755 with user root
-
mgugu
- Posts: 226
- Joined: Friday 04 November 2016 12:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: France
- Contact:
Re: how to create new dzVents script with templates
Same hereGravityz wrote: Tuesday 10 January 2023 17:40 i checked with my setup
all the directories have user rights 0755 with user root
Who is online
Users browsing this forum: No registered users and 1 guest