Set alarm only only if all sensor is off

Moderator: leecollings

Post Reply
Revers59
Posts: 13
Joined: Friday 12 May 2017 13:53
Target OS: Linux
Domoticz version:
Contact:

Set alarm only only if all sensor is off

Post by Revers59 »

Hello All
I have 3 switchs for arm or disarm my alarm. If I click on a switch the alarm is on if i double click the alarm is off.
If I click on one of the switch I d'ont want to arm the alarm if one of the windows or one door is open.

All work fine but I add one switch last week and now my script arm the alarm even if a windows is open.

I remember add some carraige return for help to read the script but I don't know if this is a mistake.

Code: Select all

commandArray = {}
if (devicechanged['Xiaomi Wireless Switch'] == 'Click' 
    or devicechanged['Xiaomi Wireless Switch etage'] == 'Click' 
    or devicechanged['Xiaomi Wireless Switch garage'] == 'Click' 
    and otherdevices['Xiaomi Door Sensor porte entree'] == 'Closed' 
    and otherdevices['Xiaomi Door Sensor porte jardin'] == 'Closed' 
    and otherdevices['Xiaomi Door Sensor salle de bain'] == 'Closed' 
    and otherdevices['Xiaomi Door Sensor Cuisine'] == 'Closed' 
    and otherdevices['Xiaomi Door Sensor Salon'] == 'Closed') then
print('AlarmPanel Arm Away')
commandArray['Domoticz Security Panel'] = 'Arm Away'
commandArray['SendNotification']='Alerte #Alarme armee en absence!'
commandArray['Xiaomi Wireless Switch'] = 'Off'
commandArray['Xiaomi Wireless Switch etage'] = 'Off'
commandArray['Xiaomi Wireless Switch garage'] = 'Off'
elseif
(devicechanged['Xiaomi Wireless Switch'] == 'Click' 
    or devicechanged['Xiaomi Wireless Switch etage'] == 'Click'
    or devicechanged['Xiaomi Wireless Switch garage'] == 'Click') then
commandArray['Xiaomi Wireless Switch'] = 'Off'
commandArray['Xiaomi Wireless Switch etage'] = 'Off'
commandArray['Xiaomi Wireless Switch garage'] = 'Off'
commandArray['SendNotification']='Alerte #Alarme non activée car une porte ou fenêtre est ouverte!'
end

return commandArray
Revers59
Posts: 13
Joined: Friday 12 May 2017 13:53
Target OS: Linux
Domoticz version:
Contact:

Re: Set alarm only only if all sensor is off

Post by Revers59 »

I add some ( and ) And think it's good :)

Code: Select all

commandArray = {}
if (devicechanged['Xiaomi Wireless Switch'] == 'Click' 
    or devicechanged['Xiaomi Wireless Switch etage'] == 'Click' 
    or devicechanged['Xiaomi Wireless Switch garage'] == 'Click') 
    and (otherdevices['Xiaomi Door Sensor porte entree'] == 'Closed' 
    and otherdevices['Xiaomi Door Sensor porte jardin'] == 'Closed' 
    and otherdevices['Xiaomi Door Sensor salle de bain'] == 'Closed' 
    and otherdevices['Xiaomi Door Sensor Cuisine'] == 'Closed' 
    and otherdevices['Xiaomi Door Sensor Salon'] == 'Closed') then
print('AlarmPanel Arm Away')
commandArray['Domoticz Security Panel'] = 'Arm Away'
commandArray['SendNotification']='Alerte #Alarme armee en absence!'
commandArray['Xiaomi Wireless Switch'] = 'Off'
commandArray['Xiaomi Wireless Switch etage'] = 'Off'
commandArray['Xiaomi Wireless Switch garage'] = 'Off'
elseif
(devicechanged['Xiaomi Wireless Switch'] == 'Click' 
    or devicechanged['Xiaomi Wireless Switch etage'] == 'Click'
    or devicechanged['Xiaomi Wireless Switch garage'] == 'Click') then
commandArray['Xiaomi Wireless Switch'] = 'Off'
commandArray['Xiaomi Wireless Switch etage'] = 'Off'
commandArray['Xiaomi Wireless Switch garage'] = 'Off'
commandArray['SendNotification']='Alerte #Alarme non activée car une porte ou fenêtre est ouverte!'
end

return commandArray
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Set alarm only only if all sensor is off

Post by Egregius »

I do similar stuff when arming.
I also let my doorbell ring and in the notification the exact door/window is mentioned ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest