first commit

This commit is contained in:
Souti
2025-03-06 11:09:58 +01:00
commit 11f7d440ff
330 changed files with 38306 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
-- Check the wiki for dzVents
-- remove what you don't need
return {
-- optional active section,
-- when left out the script is active
-- note that you still have to check this script
-- as active in the side panel
active = {
true, -- either true or false, or you can specify a function
--function(domoticz)
-- return true/false
--end
},
-- trigger
-- can be a combination:
on = {
-- device triggers
devices = {
-- 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 abc
258, -- id
},
-- timer riggers
timer = {
-- 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 false
end
},
-- user variable triggers
variables = {
'myUserVariable'
},
-- security triggers
security = {
domoticz.SECURITY_ARMEDAWAY,
domoticz.SECURITY_ARMEHOME,
},
-- scene triggers
scenes = {
'myScene'
},
-- group triggers
groups = {
'myGroup'
},
-- http http responses
httpResponses = {
'some callback string'
},
-- system events
system = {
'start',
'stop',
'manualBackupFinished',
'dailyBackupFinished',
'hourlyBackupFinished',
'monthlyBackupFinished'
},
customEvents = {
'myCustomEvent'
}
},
-- persistent data
-- see documentation about persistent variables
data = {
myVar = { initial = 5 },
myHistoryVar = { maxItems = 10 },
},
-- custom logging level for this script
logging = {
level = domoticz.LOG_DEBUG,
marker = "Cool script"
},
-- 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.isDevice
execute = 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.
]] --
-- example
if (triggerdItem.active) then -- state == 'On'
triggerdItem.switchOff().afterMin(2) -- if it is a switch
domoticz.notify('Light info', 'The light ' .. triggerdItem.name .. ' will be switched off soon')
end
end
}

View File

@@ -0,0 +1,18 @@
return {
on = {
devices = {},
timer = {},
variables = {},
scenes = {},
groups = {},
security = {},
httpResponses = {},
customEvents = {},
system = {},
},
data = {},
logging = {},
execute = function(domoticz, triggeredItem)
end
}

View File

@@ -0,0 +1,20 @@
return {
on = {
timer = {
'every 5 minutes' -- just an example to trigger the event
},
customEvents = {
'MyEvent' -- event triggered by emitEvent
}
},
data = {},
logging = {},
execute = function(domoticz, triggeredItem)
if (triggeredItem.isCustomEvent) then
domoticz.utils._.print(triggeredItem.data)
else
-- second parameter can be anything, number, string, boolean or table
domoticz.emitEvent('MyEvent', 'Some data')
end
end
}

View File

@@ -0,0 +1,10 @@
return {
on = {
devices = {
'myDevice'
}
},
execute = function(domoticz, device)
domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
end
}

View File

@@ -0,0 +1,10 @@
return {
on = {
groups = {
'myGroup'
}
},
execute = function(domoticz, group)
domoticz.log('Group ' .. group.name .. ' was changed', domoticz.LOG_INFO)
end
}

View File

@@ -0,0 +1,38 @@
return {
on = {
timer = {
'every 5 minutes' -- just an example to trigger the request
},
httpResponses = {
'trigger' -- must match with the callback passed to the openURL command
}
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'http://somedomain/someAPI?param=1',
method = 'GET',
callback = 'trigger', -- see httpResponses above.
})
end
if (item.isHTTPResponse) then
if (item.ok) then
if (item.isJSON) then
local someValue = item.json.someValue -- just an example
-- update some device in Domoticz
domoticz.devices('myTextDevice').updateText(someValue)
end
else
domoticz.log('There was a problem handling the request', domoticz.LOG_ERROR)
domoticz.log(item, domoticz.LOG_ERROR)
end
end
end
}

View File

@@ -0,0 +1,10 @@
return {
on = {
scenes = {
'myScene'
}
},
execute = function(domoticz, scene)
domoticz.log('Scene ' .. scene.name .. ' was changed', domoticz.LOG_INFO)
end
}

View File

@@ -0,0 +1,10 @@
return {
on = {
security = {
domoticz.SECURITY_ARMEDAWAY,
}
},
execute = function(domoticz, security)
domoticz.log('Security was triggered by ' .. security.trigger, domoticz.LOG_INFO)
end
}

View File

@@ -0,0 +1,17 @@
return {
on = {
system = {
'start',
'stop',
'manualBackupFinished',
'dailyBackupFinished',
'hourlyBackupFinished',
'monthlyBackupFinished'
}
},
data = {},
logger = {},
execute = function(domoticz, triggeredItem)
domoticz.log('Domoticz has started')
end
}

View File

@@ -0,0 +1,50 @@
return {
on = {
timer = {
'every minute', -- causes the script to be called every minute
'every other minute', -- minutes: xx:00, xx:02, xx:04, ..., xx:58
'every <xx> minutes', -- starting from xx:00 triggers every xx minutes (0 > xx < 60)
'every hour', -- 00:00, 01:00, ..., 23:00 (24x per 24hrs)
'every other hour', -- 00:00, 02:00, ..., 22:00 (12x per 24hrs)
'every <xx> hours', -- starting from 00:00, triggers every xx hours (0 > xx < 24)
'at 13:45', -- specific time
'at *:45', -- every 45th minute in the hour
'at 15:*', -- every minute between 15:00 and 16:00
'at 12:45-21:15', -- between 12:45 and 21:15. You cannot use '*'!
'at 19:30-08:20', -- between 19:30 and 8:20 then next day
'at 13:45 on mon,tue', -- at 13:45 only on Monday en Tuesday (english)
'every hour on sat', -- you guessed it correctly
'at sunset', -- uses sunset/sunrise info from Domoticz
'at sunrise',
'at sunset on sat,sun',
'xx minutes before sunset',
'xx minutes after sunset',
'xx minutes before sunrise',
'xx minutes after sunrise', -- guess ;-)
'between aa and bb', -- aa/bb can be a time stamp like 15:44
-- aa/bb can be sunrise/sunset
-- aa/bb can be 'xx minutes before/after
-- sunrise/sunset'
'at nighttime', -- between sunset and sunrise
'at daytime', -- between sunrise and sunset
'at civildaytime', -- between civil twilight start and civil twilight end
'at civilnighttime', -- between civil twilight end and civil twilight start
'at daytime on mon,tue', -- between sunrise and sunset only on monday and tuesday
-- or if you want to go really wild:
'at nighttime at 21:32-05:44 every 5 minutes on sat, sun',
'every 10 minutes between 20 minutes before sunset and 30 minutes after sunrise on mon,fri,tue',
-- or just do it yourself:
function(domoticz)
-- you can use domoticz.time to get the current time
-- note that this function is called every minute!
-- custom code that either returns true or false
return true
end,
}
},
execute = function(domoticz, timer)
domoticz.log('Timer event was triggered by ' .. timer.trigger, domoticz.LOG_INFO)
end
}

View File

@@ -0,0 +1,11 @@
return {
on = {
variables = {
'myUserVariable'
}
},
execute = function(domoticz, variable)
domoticz.log('Variable ' .. variable.name .. ' was changed', domoticz.LOG_INFO)
-- code
end
}

View File

@@ -0,0 +1,16 @@
return {
on = {
devices = {},
timer = {},
variables = {},
scenes = {},
groups = {},
security = {},
httpResponses = {}
},
data = {},
logger = {},
execute = function(domoticz, triggeredItem)
end
}

View File

@@ -0,0 +1,105 @@
-- Check the wiki for dzVents
-- remove what you don't need
return {
-- optional active section,
-- when left out the script is active
-- note that you still have to check this script
-- as active in the side panel
active = {
true, -- either true or false, or you can specify a function
--function(domoticz)
-- return true/false
--end
}
-- trigger
-- can be a combination:
on = {
-- device triggers
devices = {
-- 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 abc
258, -- id
},
-- timer riggers
timer = {
-- 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 false
end
},
-- user variable triggers
variables = {
'myUserVariable'
},
-- security triggers
security = {
domoticz.SECURITY_ARMEDAWAY,
domoticz.SECURITY_ARMEHOME,
},
-- scene triggers
scenes = {
'myScene'
},
-- group triggers
groups = {
'myGroup'
},
-- http http responses
httpResponses = {
'some callback string'
}
},
-- persistent data
-- see documentation about persistent variables
data = {
myVar = { initial = 5 },
myHistoryVar = { maxItems = 10 },
},
-- custom logging level for this script
logging = {
level = domoticz.LOG_DEBUG,
marker = "Cool script"
},
-- 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.isDevice
execute = 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.
]] --
-- example
if (triggerdItem.active) then -- state == 'On'
triggerdItem.switchOff().afterMin(2) -- if it is a switch
domoticz.notify('Light info', 'The light ' .. triggerdItem.name .. ' will be switched off soon')
end
end
}

View File

@@ -0,0 +1,10 @@
return {
on = {
devices = {
'myDevice'
}
},
execute = function(domoticz, device)
domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
end
}

View File

@@ -0,0 +1,18 @@
-- this scripts holds all the globally persistent variables and helper functions
-- see the documentation in the wiki
-- NOTE:
-- THERE CAN BE ONLY ONE global_data SCRIPT in your Domoticz install.
return {
-- global persistent data
data = {
myGlobalVar = { initial = 12 }
},
-- global helper functions
helpers = {
myHelperFunction = function(domoticz)
-- code
end
}
}

View File

@@ -0,0 +1,10 @@
return {
on = {
groups = {
'myGroup'
}
},
execute = function(domoticz, group)
domoticz.log('Group ' .. group.name .. ' was changed', domoticz.LOG_INFO)
end
}

View File

@@ -0,0 +1,10 @@
return {
on = {
scenes = {
'myScene'
}
},
execute = function(domoticz, scene)
domoticz.log('Scene ' .. scene.name .. ' was changed', domoticz.LOG_INFO)
end
}

View File

@@ -0,0 +1,10 @@
return {
on = {
security = {
domoticz.SECURITY_ARMEDAWAY,
}
},
execute = function(domoticz, security, info)
domoticz.log('Security was triggered by ' .. security.trigger, domoticz.LOG_INFO)
end
}

View File

@@ -0,0 +1,53 @@
return {
on = {
timer = {
'every minute', -- causes the script to be called every minute
'every other minute', -- minutes: xx:00, xx:02, xx:04, ..., xx:58
'every <xx> minutes', -- starting from xx:00 triggers every xx minutes
-- (0 > xx < 60)
'every hour', -- 00:00, 01:00, ..., 23:00 (24x per 24hrs)
'every other hour', -- 00:00, 02:00, ..., 22:00 (12x per 24hrs)
'every <xx> hours', -- starting from 00:00, triggers every xx
-- hours (0 > xx < 24)
'at 13:45', -- specific time
'at *:45', -- every 45th minute in the hour
'at 15:*', -- every minute between 15:00 and 16:00
'at 12:45-21:15', -- between 12:45 and 21:15. You cannot use '*'!
'at 19:30-08:20', -- between 19:30 and 8:20 then next day
'at 13:45 on mon,tue', -- at 13:45 only on Monday en Tuesday (english)
'every hour on sat', -- you guessed it correctly
'at sunset', -- uses sunset/sunrise info from Domoticz
'at sunrise',
'at sunset on sat,sun',
'xx minutes before sunset',
'xx minutes after sunset',
'xx minutes before sunrise',
'xx minutes after sunrise', -- guess ;-)
'between aa and bb', -- aa/bb can be a time stamp like 15:44
-- aa/bb can be sunrise/sunset
-- aa/bb can be 'xx minutes before/after
-- sunrise/sunset'
'at nighttime', -- between sunset and sunrise
'at daytime', -- between sunrise and sunset
'at civildaytime', -- between civil twilight start and civil twilight end
'at civilnighttime', -- between civil twilight end and civil twilight startœ
'at daytime on mon,tue', -- between sunrise and sunset
-- only on monday and tuesday
-- or if you want to go really wild:
'at nighttime at 21:32-05:44 every 5 minutes on sat, sun',
'every 10 minutes between 20 minutes before sunset and 30 minutes after sunrise on mon,fri,tue',
-- or just do it yourself:
function(domoticz)
-- you can use domoticz.time to get the current time
-- note that this function is called every minute!
-- custom code that either returns true or false
return true
end
},
},
execute = function(domoticz, timer)
domoticz.log('Timer event was triggered by ' .. timer.trigger, domoticz.LOG_INFO)
end
}

View File

@@ -0,0 +1,11 @@
return {
on = {
variables = {
'myUserVariable'
}
},
execute = function(domoticz, variable)
domoticz.log('Variable ' .. variable.name .. ' was changed', domoticz.LOG_INFO)
-- code
end
}