Monitoring Security Status

Moderator: leecollings

Post Reply
seansco
Posts: 19
Joined: Tuesday 01 March 2016 20:51
Target OS: Linux
Domoticz version:
Contact:

Monitoring Security Status

Post by seansco »

fyi, i'm a lua rookie
How do I monitor and do something (in lua) if the security status (globalvariables['Security'] i assume) changes?
I am trying to run some os commands when I use the domoticz security panel.

here is what I have so far but this just runs in an endless loop. I assume I need to an "if changed" check around this all.

Code: Select all

print('###', 'SecPanel: status changed to ' .. globalvariables['Security'])

commandArray = {}

if globalvariables['Security'] == 'Disarmed' then

        print('Security Panel - Disarmed')
        commandArray['SendNotification']='System Disarmed#System has been disarmed'
        os.execute('echo "rfsec 0x11 disarm" | nc -w 2 localhost 1099')

elseif globalvariables['Security'] == 'Armed Home' then

        print('Security Panel - Armed Home')
        commandArray['SendNotification']='System Armed (Home)#System has been armed'
        os.execute('echo "rfsec 0x11 arm_home_min" | nc -w 2 localhost 1099')

elseif globalvariables['Security'] == 'Armed Away' then

        print('Security Panel - Armed Away')
        commandArray['SendNotification']='System Armed (Away)#System has been armed'
        os.execute('echo "rfsec 0x11 arm_away_max" | nc -w 2 localhost 1099')
end

return commandArray
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest