Gday,
I am having a go at putting some rules in place for a simple home alarm that will have switch type inputs and a switch output for a siren along with a bunch of notifications.
I have set up all the items as switches and have this in the sitemap, to switch off, on(window, door & PIR) and internal (just window & door reed switches) modes.
Switch item=Alarmmode label="Alarm mode selection" mappings=[1=OFF, 2=ON, 3=Internal] icon="settings"
The first rule works well and changes state of the 3 switches. The second rule “Alarm triggers” does not seem to work.
Could someone point me in the right direction?
//Alarm Rules
rule "Alarm Mode"
when
Item Alarmmode received command
then
if(receivedCommand==1) {
sendCommand(AlarmOFF, ON)
sendCommand(AlarmON, OFF)
sendCommand(Alarminternal, OFF)
}
else
if(receivedCommand==2) {
sendCommand(AlarmOFF, OFF)
sendCommand(AlarmON, ON)
sendCommand(Alarminternal, OFF)
}
else
if(receivedCommand==3) {
sendCommand(AlarmOFF, OFF)
sendCommand(AlarmON, OFF)
sendCommand(Alarminternal, ON)
}
end
rule "Alarm triggers"
when
Item AlarmON received command ON
then
if(Windows==ON) {
sendCommand(Alarmtriggered, ON)
}
if(Doors==ON) {
sendCommand(Alarmtriggered, ON)
}
if(PIR1==ON) {
sendCommand(Alarmtriggered, ON)
}
end
Kind Regards,
George