Blame | Last modification | View Log | Download
-- Check the wiki for dzVents-- remove what you don't needreturn {-- optional active section,-- when left out the script is active-- note that you still have to check this script-- as active in the side panelactive = {true, -- either true or false, or you can specify a function--function(domoticz)-- return true/false--end},-- trigger-- can be a combination:on = {-- device triggersdevices = {-- scripts is executed if the device that was updated matches with one of these triggers'device name', -- device name'abc*', -- triggers for all devices which name begins with abc258, -- id},-- timer riggerstimer = {-- timer triggers.. if one matches with the current time then the script is executed'at 13:45','at 18:37','every 3 minutes on mon,tue,fri at 16:00-15:00',function(domoticz)-- return true or falseend},-- user variable triggersvariables = {'myUserVariable'},-- security triggerssecurity = {domoticz.SECURITY_ARMEDAWAY,domoticz.SECURITY_ARMEHOME,},-- scene triggersscenes = {'myScene'},-- group triggersgroups = {'myGroup'},-- http responseshttpResponses = {'some callback string'},-- shell commmand responsesshellCommandResponses = {'another callback string'},-- system eventssystem = {'start','stop','manualBackupFinished','dailyBackupFinished','hourlyBackupFinished','monthlyBackupFinished'},customEvents = {'myCustomEvent'}},-- persistent data-- see documentation about persistent variablesdata = {myVar = { initial = 5 },myHistoryVar = { maxItems = 10 },},-- custom logging level for this scriptlogging = {level = domoticz.LOG_INFO,marker = "template"},-- actual event code-- the second parameter is depending on the trigger-- when it is a device change, the second parameter is the device object-- similar for variables, scenes and groups and httpResponses-- inspect the type like: triggeredItem.isDeviceexecute = function(domoticz, triggeredItem, info)--[[The domoticz object holds all information about your Domoticz system. E.g.:local myDevice = domoticz.devices('myDevice')local myVariable = domoticz.variables('myUserVariable')local myGroup = domoticz.groups('myGroup')local myScene = domoticz.scenes('myScene')The device object is the device that was triggered due to the device in the 'on' section above.]] ---- exampleif (triggerdItem.active) then -- state == 'On'triggerdItem.switchOff().afterMin(2) -- if it is a switchdomoticz.notify('Light info', 'The light ' .. triggerdItem.name .. ' will be switched off soon')endend}