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