Constant or global variable in on section
Posted: Sunday 20 December 2020 20:33
Hello,
Is it possible to pass a global variable or global constant in the on section? When I try this:
I have to change this way to get it working:
Any idea to pass global constants or variables to the ON section? Variables declared just before like "sejourMasterBlindDevice", not in global_data "return" statement, are only usable in current script, because if I use them in other scripts, sometimes they will be defined, sometimes not, depending on the order of scripts evaluation.
Than you for your ideas.
Is it possible to pass a global variable or global constant in the on section? When I try this:
Code: Select all
-- master blind
sejourMasterBlindDevice = "Volet séjour"
-- slave blinds
sejourSlaveBlindDevices = {"Volet lingerie"}
-- slave groups
sejourSlaveGroupDevices = {"Groupe volets séjour"}
-- specific time to wait for before opening
sejourSpecificTime = "08:10"
-- slave blinds 2 at specificTime
sejourSlaveBlindDevicesAfterSpecificTime = {"Volet salon ouest"}
return {
on = {
timer = {
"at " .. sejourSpecificTime
devices = {
domoticz.globalData.dayDevice,
sejourMasterBlindDevice
},Code: Select all
2020-12-20 20:27:00.557 Error: dzVents: Error: (3.0.2) .../scripts/dzVents/generated_scripts/Maître séjour 3.lua:18: attempt to index a nil value (field 'globalData') Code: Select all
-- master blind
sejourMasterBlindDevice = "Volet séjour"
-- slave blinds
sejourSlaveBlindDevices = {"Volet lingerie"}
-- slave groups
sejourSlaveGroupDevices = {"Groupe volets séjour"}
-- specific time to wait for before opening
sejourSpecificTime = "08:10"
-- slave blinds 2 at specificTime
sejourSlaveBlindDevicesAfterSpecificTime = {"Volet salon ouest"}
return {
on = {
timer = {
"at " .. sejourSpecificTime
},
devices = {
"Il fait jour",
sejourMasterBlindDevice
}
},Than you for your ideas.