Hi,
I updated my domoticz installation today, it's installed on a raspberry pi:
Current version(s)
Version: 2021.1
Build Hash: 8547c5b7e
Compile Date: 2021-04-17 17:29:11
dzVents Version: 3.1.7
Python Version: None
In my script, some things seems to have stopped working, one example seems to be the afterSec
This works:
dz.helpers.functions.notify(dz, 'Test')
This is generating errors:
dz.helpers.functions.notify(dz, 'Test').afterSec(30)
I get errors in the logs, like this:
Error: dzVents: Error: (3.1.7) template: ...moticz/scripts/dzVents/generated_scripts/global_data.lua:21: attempt to index a nil value
The funny thing is that the script is actually executed, but the afterSec seems to be skipped and are generating an error.
If I do this:
dz.helpers.functions.notify(dz, 'Test 2')
dz.helpers.functions.notify(dz, 'Test 1').afterSec(30)
... other lines of code after above will not be executed ...
The two first lines notify are called, but nothing more, so it has to be the afterSec causing this problem?
Any ideas?
DzVents afterSec problems [Solved]
Moderator: leecollings
-
- Posts: 7
- Joined: Tuesday 10 March 2020 9:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
-
- Posts: 528
- Joined: Saturday 02 June 2018 11:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V2022.1
- Location: Echt, Netherlands
- Contact:
Re: DzVents afterSec problems
Yesterday i made a new script, with all execute commands .afterSec in it. I got the same error like you have.
Didn't know why.
I removed the .afterSec and triggered the script, that it runs without the .afterSec in it. The error was now gone. After that i added the .afterSec and it now works without errors and .afterSec in the script
Didn't know why.
I removed the .afterSec and triggered the script, that it runs without the .afterSec in it. The error was now gone. After that i added the .afterSec and it now works without errors and .afterSec in the script
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DzVents afterSec problems
dz.helpers is a table with data and functions designed by you, to share between multiple scripts. Without seeing table (in global_data.lua) it 's impossible to have a clue on what's going on. Given the nature of dz.helpers I have strong doubts it ever worked like this (with .afterSec()) or you must have setup collections in global_data.lua and effectively repeated a big part of the dzVents runtime code in this user file.BlackSabbath wrote: ↑Saturday 29 May 2021 0:34 In my script, some things seems to have stopped working, one example seems to be the afterSec
dz.helpers.functions.notify(dz, 'Test')
This is generating errors:
dz.helpers.functions.notify(dz, 'Test').afterSec(30)
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
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DzVents afterSec problems
What kind of execute commands? Please share the script.
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
-
- Posts: 7
- Joined: Tuesday 10 March 2020 9:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DzVents afterSec problems
Hi,
Yes, on purpose I will make the scripts simple ( of course these specific script are tested by me too )
This "file":
global_data
Consists of this code
return {
-- global persistent data
data = {
},
-- global helper functions
helpers = {
functions = {
myTest1 = function (dz, str1)
dz.log('myTest1 executed:' .. str1)
end
}
}
}
This "file":
Test1
Consists of this code
return {
on = {
timer = {
'every minute', -- causes the script to be called every minute
}
},
execute = function(dz, timer)
dz.helpers.functions.myTest1(dz, 'not afterSec')
dz.helpers.functions.myTest1(dz, 'afterSec').afterSec(10)
end
}
This will execute every minute. The output in the log reads:
2021-05-31 14:45:00.251 Status: dzVents: Info: myTest1 executed:not afterSec
2021-05-31 14:45:00.251 Status: dzVents: Info: myTest1 executed:afterSec
2021-05-31 14:45:00.252 Status: dzVents: Info: ------ Finished Test1
2021-05-31 14:45:00.252 Error: dzVents: Error: (3.1.7) An error occurred when calling event handler Test1
2021-05-31 14:45:00.252 Error: dzVents: Error: (3.1.7) .../pi/domoticz/scripts/dzVents/generated_scripts/Test1.lua:10: attempt to index a boolean value
Yes, on purpose I will make the scripts simple ( of course these specific script are tested by me too )
This "file":
global_data
Consists of this code
return {
-- global persistent data
data = {
},
-- global helper functions
helpers = {
functions = {
myTest1 = function (dz, str1)
dz.log('myTest1 executed:' .. str1)
end
}
}
}
This "file":
Test1
Consists of this code
return {
on = {
timer = {
'every minute', -- causes the script to be called every minute
}
},
execute = function(dz, timer)
dz.helpers.functions.myTest1(dz, 'not afterSec')
dz.helpers.functions.myTest1(dz, 'afterSec').afterSec(10)
end
}
This will execute every minute. The output in the log reads:
2021-05-31 14:45:00.251 Status: dzVents: Info: myTest1 executed:not afterSec
2021-05-31 14:45:00.251 Status: dzVents: Info: myTest1 executed:afterSec
2021-05-31 14:45:00.252 Status: dzVents: Info: ------ Finished Test1
2021-05-31 14:45:00.252 Error: dzVents: Error: (3.1.7) An error occurred when calling event handler Test1
2021-05-31 14:45:00.252 Error: dzVents: Error: (3.1.7) .../pi/domoticz/scripts/dzVents/generated_scripts/Test1.lua:10: attempt to index a boolean value
-
- Posts: 7
- Joined: Tuesday 10 March 2020 9:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DzVents afterSec problems
Hi,
I'm 100% sure this worked before I updated the version with exactly the same code.
I'm not even sure how you mean? Where and when should this not be working?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: DzVents afterSec problems [Solved]
Please follow the wiki ( see this) when creating global_data,lua and share the file that worked before.
As you shared it now it cannot work and could never have worked.
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
-
- Posts: 7
- Joined: Tuesday 10 March 2020 9:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: DzVents afterSec problems
Hi,waaren wrote: ↑Monday 31 May 2021 21:29 Please follow the wiki ( see this) when creating global_data.lua and share the file that worked before.
As you shared it now it cannot work and could never have worked.
You are most likely right, I cannot use these kinds of delay's on methods, just on devices, right?
It looks like I have mixed it up a little bit
Thank you very much
Who is online
Users browsing this forum: No registered users and 1 guest