-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWX_cam_helper.lua
39 lines (31 loc) · 1.31 KB
/
WX_cam_helper.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
-- WX Camera helper dzVents Script
-- Martin Saidl 2021
local version = '1.0' -- current version of script
------------------------------------------------------------------------
local LOGGING = false -- true or false LOGGING info to domoticz log.
local shellScript = '/config/scripts/shell_scripts/wxcam/bin/wxcam.sh'
local function log(domoticz, text, lvlError)
local lvlLog = domoticz.LOG_INFO
if lvlError ~= nil and lvlError == true then lvlLog = domoticz.LOG_ERROR end
if LOGGING then domoticz.log(text, lvlLog) end
end
return {
logging = {
-- level = domoticz.LOG_ERROR,
marker = "WX_Camera_helper"
},
on = {
timer = { 'every 5 minutes' } -- or can be change to 'every minute'
},
execute = function(domoticz)
log(domoticz,'')
log(domoticz,'WX_Camera_helper ver: ' .. version)
log(domoticz,'Executing shell command: ' .. shellScript)
local fileHandle = assert(io.popen(shellScript, 'r'))
local commandOutput = assert(fileHandle:read('*a'))
local returnTable = {fileHandle:close()}
log(domoticz, "Return Code: " .. returnTable[3])
log(domoticz, "Command Output: " .. commandOutput)
log(domoticz,'Done')
end
}