-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscript_time_garbagecalendar.lua
46 lines (42 loc) · 1.47 KB
/
script_time_garbagecalendar.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
----------------------------------------------------------------------------------------------------------------
-- Event start script for GarbageCalendar huisvuil script: script_time_garbagecalendar.lua
-- Works both in DzVents and Regular LUA time scripts
----------------------------------------------------------------------------------------------------------------
EventScriptVersion = '20241226-2030'
-- set variable to false=disable or true=enable the script
local GC_enabled = true
-- Get script path
function script_path()
local str = debug.getinfo(2, 'S').source:sub(2)
return str:match('(.*[/\\])')
end
local GC_scriptpath = script_path() or './'
-- run the script and check for errors.
function run_garbagecalendar(GC_scriptpath, commandArray, domoticz)
dofile(GC_scriptpath .. 'garbagecalendar/gc_main.lua')
local rc, errmsg = pcall(gc_main, commandArray, domoticz)
if not rc then
print('-----done with error', errmsg)
end
end
-- determine if this is a DzVents or Regular LUA time script
if (_G.scriptsFolderPath ~= nil) then
return {
active = GC_enabled,
on = {
timer = {'Every 1 minutes'}
},
execute = function(domoticz)
-- run the script when enabled (true)
run_garbagecalendar(GC_scriptpath, nil, domoticz)
end
}
else
-- Regular Time Event script
commandArray = {}
-- run the script when enabled (true)
if GC_enabled then
run_garbagecalendar(GC_scriptpath, commandArray, nil)
end
return commandArray
end