Hi,
I need help with the global_data.lua
When I save the file global_data.lua in ~/domoticz/scripts/dzVents/scripts/ following errors are generated every minute:
2021-12-19 13:35:33.708 Error: dzVents: Error: (3.1.7) iDS: There was an issue with the require of the datamodule “~/domoticz/scripts/dzVents/data/__data_global_data.lua"
2021-12-19 13:35:33.709 Error: EventSystem: in ~/domoticz/dzVents/runtime/dzVents.lua: ~/domoticz/dzVents/runtime/EventHelpers.lua:121: attempt to index a nil value (local 'inf')
In ~/domoticz/scripts/dzVents/data/ a 0 byte file __data_global_data.faulty is created by root (domoticz is running as root, I haven’t succeeded in changing this). It seems that __data_global_data.lua is missing.
file global_data.lua:
return {
helpers = {},
data = {
myOldIP = { initial = false },
E_ICSEvent = { initial = false},
I_ICSEvent = { initial = false}
}
}
Any hint on how to solve this would be welcome.
Regards, Ed
global_data problem
Moderator: leecollings
-
- Posts: 58
- Joined: Saturday 27 January 2018 20:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: global_data problem
I don't see a problem in the global_data.
Do you use the global variables in any of your scripts? Maybe the problem starts there.
Do you use the global variables in any of your scripts? Maybe the problem starts there.
Re: global_data problem
Hi Maxx,
thx for your reply (and sorry I didn't respond earlier, busy with X-mass prep.) but I removed all possible lines that use the globaldata from the scripts and the error keeps coming back. I also checked that there is only 1 global_data.lua file, I found 3 in:
~/domoticz/dzVents/runtime/tests/scripts/global_data.lua
~/domoticz/dzVents/runtime/integration-tests/global_data.lua
~/domoticz/scripts/dzVents/examples/templates/global_data.lua
Renaming them didn't change anything. The error I get is in EventHelpers.lua:121, which is the line 'outf:write(inf:read('*a'))' . So this script cannot write to the outf (~/domoticz/scripts/dzVents/data/__data_global_data.lua) because it doesn't exist, instead a file ~/domoticz/scripts/dzVents/data/__data_global_data.fault (0 bytes) was created.
I'm running domoticz on a raspberry pi 3B under my own user-id and the file ~/domoticz/scripts/dzVents/data/__data_global_data.fault is created by root. I'm thinking it may be a rights problem in creating the file, could that be?
Regards, Ed
thx for your reply (and sorry I didn't respond earlier, busy with X-mass prep.) but I removed all possible lines that use the globaldata from the scripts and the error keeps coming back. I also checked that there is only 1 global_data.lua file, I found 3 in:
~/domoticz/dzVents/runtime/tests/scripts/global_data.lua
~/domoticz/dzVents/runtime/integration-tests/global_data.lua
~/domoticz/scripts/dzVents/examples/templates/global_data.lua
Renaming them didn't change anything. The error I get is in EventHelpers.lua:121, which is the line 'outf:write(inf:read('*a'))' . So this script cannot write to the outf (~/domoticz/scripts/dzVents/data/__data_global_data.lua) because it doesn't exist, instead a file ~/domoticz/scripts/dzVents/data/__data_global_data.fault (0 bytes) was created.
I'm running domoticz on a raspberry pi 3B under my own user-id and the file ~/domoticz/scripts/dzVents/data/__data_global_data.fault is created by root. I'm thinking it may be a rights problem in creating the file, could that be?
Regards, Ed
Re: global_data problem
Yes I think it is a write access problem.
When Domoticz is started as a service, it is normally as user root.
My global_data is in the ~/domoticz/scripts/dzVents/scripts dir.
This is how my dirs under ~/domoticz/scripts/dzVents looks like.
When Domoticz is started as a service, it is normally as user root.
My global_data is in the ~/domoticz/scripts/dzVents/scripts dir.
This is how my dirs under ~/domoticz/scripts/dzVents looks like.
Code: Select all
drwxr-xr-x 1 pi pi 1450 Dec 26 12:24 data
drwxr-xr-x 1 pi pi 20 Nov 9 2020 dumps
drwxr-xr-x 1 pi pi 914 Apr 13 2021 examples
drwxr-xr-x 1 pi pi 18 Nov 9 2020 generated_scripts
drwxrwxrwx 1 pi pi 266 Oct 31 08:11 modules
drwxr-xr-x 1 pi pi 2480 Nov 9 2020 scripts
Re: global_data problem
Hi EddyG,
looks similar to mine except that I don't have a modules directory therefore a file module.log as well as a file domoticzData.lua created by root. I have no idea what these file are for. domoticzData.lua is the persistent data of the devices and the module.log is a 40' log file of the modules.
drwxr-xr-x 2 me me 4096 Dec 19 13:55 data
-rw-r----- 1 root root 76127 Dec 19 17:51 domoticzData.lua
drwxr-xr-x 2 me me 4096 Nov 9 2020 dumps
drwxr-xr-x 3 me me 4096 Apr 13 2021 examples
drwxr-xr-x 2 me me 4096 Nov 9 2020 generated_scripts
-rw-r----- 1 root root 8287 Dec 19 17:51 module.log
drwxr-xr-x 2 me me 4096 Dec 26 13:24 scripts
looks similar to mine except that I don't have a modules directory therefore a file module.log as well as a file domoticzData.lua created by root. I have no idea what these file are for. domoticzData.lua is the persistent data of the devices and the module.log is a 40' log file of the modules.
drwxr-xr-x 2 me me 4096 Dec 19 13:55 data
-rw-r----- 1 root root 76127 Dec 19 17:51 domoticzData.lua
drwxr-xr-x 2 me me 4096 Nov 9 2020 dumps
drwxr-xr-x 3 me me 4096 Apr 13 2021 examples
drwxr-xr-x 2 me me 4096 Nov 9 2020 generated_scripts
-rw-r----- 1 root root 8287 Dec 19 17:51 module.log
drwxr-xr-x 2 me me 4096 Dec 26 13:24 scripts
Re: global_data problem
The 'extra' files are from the debug mode Domoticz is in.
Just change the rights of the data dir to 777 and see if the error still exists.
Just change the rights of the data dir to 777 and see if the error still exists.
Re: global_data problem
I changed the rights of the data dir to 777 and the error still exists.
drwxrwxrwx 2 me me 4096 Dec 19 13:55 data
It still creates the file
-rw-r----- 1 root root 0 Dec 27 12:08 __data_global_data.faulty
drwxrwxrwx 2 me me 4096 Dec 19 13:55 data
It still creates the file
-rw-r----- 1 root root 0 Dec 27 12:08 __data_global_data.faulty
Re: global_data problem
So there is an error in global_data.lua
You have an variable myOldIP = { initial = false } initialized as a Boolean, is that correct?
You have an variable myOldIP = { initial = false } initialized as a Boolean, is that correct?
Re: global_data problem
Hi EddyG,
That was the mistake indeed, I changed that in myOldIP = "" and now it works. Thanks for the help.
I first tried with myOldIP = { initial = "" } but that didn't work, the 'DzVents: next generation Lua scripting' is not very clear on how to use initial.
Regards, Ed
That was the mistake indeed, I changed that in myOldIP = "" and now it works. Thanks for the help.
I first tried with myOldIP = { initial = "" } but that didn't work, the 'DzVents: next generation Lua scripting' is not very clear on how to use initial.
Regards, Ed
Who is online
Users browsing this forum: No registered users and 1 guest