I have a custom home alarm setup with my OpenHAB system which includes the item “alarmState” which holds the value of the alarm as either “Disarmed”, “Armed”, or “Triggered”. I’ve noticed that after several recent power outages in my area, the default state for “alarmState” is “Armed” when I would prefer it to be “Disarmed”. I am unsure as to why the initial item state isn’t “null”. Additionally after a power outage today, the alarm reinitialized as “Armed” and then was subsequently “Triggered” thereafter by motion from my family. One thing to add was that although our WiFi connection was restored, our WLAN/Internet connection was still knocked out. Several hours later when I went to reset our modem in attempts to restore the Internet connection, the alarm state was once again reset to “Armed”. I’ve noted the event below with a screenshot from the OpenHAB log, Internet was restored about 2 minutes before the timeout occurred.
.items
String alarmStatus “[%s]” {mqtt=“<[mosquitto:/home/alarm/controller/state:state:default”}
String alarmControllerCommand {mqtt=“>[mosquitto:/home/alarm/controller/command:command:*:default]”}
String alarmKeypadInput “Input [%s]”
String alarmZone1 {mqtt=“<[mosquitto:/home/alarm/zone1/state:state:default”}
String alarmZone2 {mqtt=“<[mosquitto:/home/alarm/zone2/state:state:default”}
.rules
rule “Motion detected”
when
Item alarmZone1 changed to Motion or Item alarmZone2 changed to Motion
then
if(alarmStatus.state.toString == “Armed”) { //If motion is detected and system is armed
alarmStatus.sendCommand(“Triggered”)
}
if(alarmStatus.state.toString == “Chime”) { //If motion is detected and system is on chime
playSound(“chime.mp3”)
}
end
rule “Keypad input”
when
Item alarmKeypadInput received command
then
if(alarmKeypadInput.state.toString == “") { //If correct PIN is entered
if(alarmStatus.state.toString != “Disarmed”) { //And system is not disarmed
alarmStatus.sendCommand(“Disarmed”)
}
}
if(alarmKeypadInput.state.toString != "”) { //If incorrect PIN is entered
playSound(“incorrect.mp3”)
}
end
rule “Alarm given command”
when
Item alarmStatus received update
then
switch(alarmStatus.state.toString) {
case “Arm”: {
alarmControllerCommand.sendCommand(“Arm”)
}
case “Armed”: {
playSound(“armed.mp3”)
}
case “Disarmed”: {
alarmControllerCommand.sendCommand(“Disarmed”)
playSound(“welcome.mp3”)
}
case “Chime”: {
alarmControllerCommand.sendCommand(“Chime”)
playSound(“chime.mp3”)
}
case “Triggered”: {
alarmControllerCommand.sendCommand(“Triggered”)
playSound(“alarm triggered.mp3”)
sendNotification(“***”, “WARNING, home alarm triggered!”)
}
}
end
Anyone have any ideas why a power reboot on OpenHAB or a restoration of a WLAN connection could cause “alarmState” to be set to “Armed”?