Alarm Trigger Event via LUA (solved) Topic is solved

Moderator: leecollings

Post Reply
roy1982hd
Posts: 4
Joined: Monday 13 March 2017 21:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Alarm Trigger Event via LUA (solved)

Post by roy1982hd »

Hi everybody,

My LUA-intruder-alarm-event seems to contain a small mistake.

Protocol says:
Error: EventSystem: in Alarmfall Einbruch: [string "commandArray = {} ..."]:4: ')' expected near '='
Here's the event-code:

Code: Select all

commandArray = {}
 if (devicechanged['FensterOderTuerOffen']) then
        if (otherdevices['FensterOderTuerOffen'] == 'On') then
                if (otherdevices['Domoticz Security Panel'] = 'Arm Away') then
                    commandArray['Group:Alarmmelder']='On FOR 60'
                    print('Einbruch! Alarmmelder angeschaltet für 60 Minuten!')
                elseif (otherdevices['Domoticz Security Panel'] = 'Disarm') then
                    print('Tür oder Fenster wurde geöffnet')
                end
        else
                print('Alle Türen und Fenster geschlossen')
        end
end
return commandArray
Can anyone help me to find the mistake? Where is the bracket missing?

Thanks in advance!
Last edited by roy1982hd on Saturday 18 March 2017 2:23, edited 1 time in total.
User avatar
jvdz
Posts: 2333
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Alarm Trigger Event via LUA / Can't find the mistake

Post by jvdz »

if (otherdevices['Domoticz Security Panel'] = 'Arm Away') then
should be
if (otherdevices['Domoticz Security Panel'] == 'Arm Away') then

and
elseif (otherdevices['Domoticz Security Panel'] = 'Disarm') then
should be
elseif (otherdevices['Domoticz Security Panel'] == 'Disarm') then
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
roy1982hd
Posts: 4
Joined: Monday 13 March 2017 21:42
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Alarm Trigger Event via LUA / Can't find the mistake

Post by roy1982hd »

Thank you very much, Jos!

Just tested it and the alarm-event works now!



I) ALARM TRIGGER EVENT
1) FensterOderTuerOffen' = is a virtual device that is a parent switch of all door and window-sensors
2) 'Alarmmelder' = is a group that controls all sirens/smoke detectors

Code:

Code: Select all

commandArray = {}
 if (devicechanged['FensterOderTuerOffen']) then
        if (otherdevices['FensterOderTuerOffen'] == 'On') then
                if (otherdevices['Domoticz Security Panel'] == 'Arm Away') then
                    commandArray['Group:Alarmmelder']='On FOR 60'
                    print('Einbruch! Alarmmelder angeschaltet für 60 Minuten!')
                elseif (otherdevices['Domoticz Security Panel'] == 'Disarm') then
                    print('Tür oder Fenster wurde geöffnet')
                end
        else
                print('Alle Türen und Fenster geschlossen')
        end
end
return commandArray

----------------------------------

II) Zipato RFID Keypad EVENT

With a second event I control the actions of a Zipato RFID Keypad.
If the Zipato is switched to "Away", the Security Panel is switched to "Arm Away" and two Zipato RGBW bulbs (one inside and one outside of the front door of our house) give an orange light ... like a security status LED.
If the Zipato is switched to "Home", the Security Panel is switched to "Disarm" and the bulbs light in green colour and then switch off after some seconds.

Code:

Code: Select all

commandArray = {}
 if (devicechanged['Keypad']) then
        if (otherdevices['Keypad'] == 'On') then
                print('AlarmPanel Arm Away')
                commandArray['Domoticz Security Panel'] = 'Arm Away'
                commandArray['Group:Alarmstatuslampen orange']='On'
        else
                print('AlarmPanel Disarm')
                commandArray['Domoticz Security Panel'] = 'Disarm'
                commandArray['Group:Alarmmelder']='Off'
                commandArray['Group:Alarmstatuslampen grün']='On'
                commandArray['Alarmstatuslampe innen']='Off AFTER 10'
                commandArray['Alarmstatuslampe außen']='Off AFTER 10'
        end
end
return commandArray
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest