Many people were asking how and I got the Lupus XT2 Plus Alarm System working with openHAB. Here are my configuration files:
alarmlupus.things:
Thing http:url:alarmlupus "Lupus XT2 Plus" [baseURL="http://192.168.212.26/action/panelCondGet",refresh=10,timeout=3000,username="user",password="pass"] {
Channels:
Type switch : zonearmed1 "Zone 1 Armed" [stateTransformation="JSONPATH:$.forms.pcondform1.mode", onValue="1", offValue="0", mode="READONLY" ]
Type switch : zonearmed2 "Zone 2 Armed" [stateTransformation="JSONPATH:$.forms.pcondform2.mode", onValue="1", offValue="0", mode="READONLY" ]
}
alarmlupus.items:
Switch AlarmLupusZoneArmed1 "Alarm Lupus Zone 1" <status> (gAlarm) { channel="http:url:alarmlupus:zonearmed1" }
Switch AlarmLupusZoneArmed2 "Alarm Lupus Zone 2" <status> (gAlarm) { channel="http:url:alarmlupus:zonearmed2" }
The above files only allow reading the status to find out if Zone1 and Zone2 are armed. The following file is necessary to arm/disarm Zone1/2:
alarmlupus.rules:
rule "AlarmLupusZoneArmed1 changed"
when
Item AlarmLupusZoneArmed1 changed
then
var string json = sendHttpGetRequest("http://user:pass@192.168.212.26/action/tokenGet")
var String token = transform("JSONPATH", "$.message", json)
logInfo("rules", token)
var headers = newHashMap("X-Requested-With" -> "XMLHttpRequest", "X-Token" -> token)
if (AlarmLupusZoneArmed1.state == ON) {
var string res = sendHttpPostRequest("http://user:pass@192.168.212.26/action/panelCondPost", "application/x-www-form-urlencoded", "area=1&mode=1", headers, 10000)
logInfo("rules", res)
}
else {
var string res = sendHttpPostRequest("http://user:pass@192.168.212.26/action/panelCondPost", "application/x-www-form-urlencoded", "area=1&mode=0", headers, 10000)
logInfo("rules", res)
}
end
rule "AlarmLupusZoneArmed2 changed"
when
Item AlarmLupusZoneArmed2 changed
then
var string json = sendHttpGetRequest("http://user:pass@192.168.212.26/action/tokenGet")
var String token = transform("JSONPATH", "$.message", json)
logInfo("rules", token)
var headers = newHashMap("X-Requested-With" -> "XMLHttpRequest", "X-Token" -> token)
if (AlarmLupusZoneArmed2.state == ON) {
var string res = sendHttpPostRequest("http://user:pass@192.168.212.26/action/panelCondPost", "application/x-www-form-urlencoded", "area=2&mode=1", headers, 10000)
logInfo("rules", res)
}
else {
var string res = sendHttpPostRequest("http://user:pass@192.168.212.26/action/panelCondPost", "application/x-www-form-urlencoded", "area=2&mode=0", headers, 10000)
logInfo("rules", res)
}
end
I hope that this will be useful for someone.