device trigger time-rule constraint
Posted: Thursday 02 November 2017 14:31
I know this is really basic and silly question to ask, but I can't seem to find the right syntax for this command. I'm trying to use the 'at nighttime' constrain on a device trigger.
The documentation gives this as an example.
This is my code
The error I get
Error: dzVents: Error: error loading module 'motion' from file '/data/home/domoticz/scripts/dzVents/scripts/motion.lua':
/data/home/domoticz/scripts/dzVents/scripts/motion.lua:15: '}' expected (to close '{' at line 10) near '='
Line 10 is 'device=...'
Line 15 '] = 'at nighttime'
I realize I can put the time test in the execute part, but the whole point of using dzVents is to stop this code getting executed unless absolutely necessary. I have a very elaborate motion trigger / light setup that I wrote in C using MQTT events because of the limitations using previous versions of scripts in Domoticz and having to be executed on every event, dzVents looks like the perfect reason to port this.
The documentation gives this as an example.
Code: Select all
on = { devices = { ['myDevice'] = 'at nighttime' } }Code: Select all
return {
active = true,
on = {
devices = { [
'Driveway Cam Motion',
'Front Door Cam Motion',
'Back Door Cam Motion',
'Back Garden Cam Motion'
] = 'at nighttime'
}
},
execute = function(domoticz, switch)
..............
Error: dzVents: Error: error loading module 'motion' from file '/data/home/domoticz/scripts/dzVents/scripts/motion.lua':
/data/home/domoticz/scripts/dzVents/scripts/motion.lua:15: '}' expected (to close '{' at line 10) near '='
Line 10 is 'device=...'
Line 15 '] = 'at nighttime'
I realize I can put the time test in the execute part, but the whole point of using dzVents is to stop this code getting executed unless absolutely necessary. I have a very elaborate motion trigger / light setup that I wrote in C using MQTT events because of the limitations using previous versions of scripts in Domoticz and having to be executed on every event, dzVents looks like the perfect reason to port this.