acaonweb wrote:
1) in device u trigger WAT_lavatrice i think is the seat plug you have in the function doesn't appears something like
Code: Select all
execute = function(domoticz, device)
but
Code: Select all
execute = function(dz, devWat, tgInfo)
i can't understand that.. what are devWat and tginfo?
ok... You have to understand the dzVents framework structure then...
the trigger of the script is based on 2 separates events:
Code: Select all
on = {
devices = {'WAT_Lavatrice'},
timer = {'every minute'}
},
a DEVICE info based on the update coming from the device WAT_Lavatrice (which is in my case the power consumption on the plug attached to the washingmachine)
a TIMER eventi that triggers every minute.
Why? because the device trigger must do some stuff (compare values and act by consequences) while the timer function have to count (if necessary) the minutes passed
Code: Select all
execute = function(dz, devWat, tgInfo)
dz, devWat,tgInfo are simple names... they could be even named domoticz, device, triggerinfo or foo, bar, zoo.... you just have to respect them in the code
dz (or domoticz) = the entire Domoticz table containing all the nodes, variables and other useful stuff
devWat( or device) = contain ONLY the information about the device/variable that trigger the event, in case of timer info the table in null
tgInfo = the trigger information. this is a special table that contains information about why the scripts have been triggered
hope this will helps you to better understand it
ciao
M