Anpassung der letzten Tage

This commit is contained in:
Patrick Niebeling
2019-12-04 16:47:14 +01:00
parent f88f88752e
commit 1193e1a93c
3 changed files with 84 additions and 43 deletions

View File

@ -2,7 +2,7 @@ import java.util.concurrent.locks.ReentrantLock
var ReentrantLock lockState = new ReentrantLock()
var Timer FFAlarmTimer = null
rule "FFAlarmRuleJSON"
rule "Auswertung Alarm JSON"
when
Item FFAlarmJSON changed
then
@ -38,31 +38,59 @@ then
postUpdate(FFAlarmTrigger,transform("JSONPATH","$.AlarmTrigger",FFAlarmJSON.state.toString))
end
rule "FFAlarmTrigger OF"
rule "FFR Alarm Logik"
when
Item FFAlarmTrigger changed to ON
then
postUpdate(FHZPush,"ON")
postUpdate(REMCAM001Record,"ON")
postUpdate(REMCAM002Record,"ON")
FFAlarmTimer = createTimer(now.plusMinutes(60)) [|
postUpdate(FFAlarmTrigger,"OFF")
postUpdate(FHZPush,"OFF")
postUpdate(REMCAM001Record,"OFF")
postUpdate(REMCAM002Record,"OFF")
FFAlarmTimer.cancel()
FFAlarmTimer = null
]
if (FFRAlarmTimer === null) {
postUpdate(FFAlarmView,"ON")
postUpdate(FHZPush,"ON")
postUpdate(REMCAM001Record,"ON")
postUpdate(REMCAM002Record,"ON")
FFAlarmTimer = createTimer(now.plusMinutes(60)) [|
postUpdate(FFAlarmTrigger,"OFF")
postUpdate(FHZPush,"OFF")
postUpdate(REMCAM001Record,"OFF")
postUpdate(REMCAM002Record,"OFF")
FFAlarmTimer.cancel()
FFAlarmTimer = null
]
}
end
rule "FFAlarmTrigger OF"
rule "FFAlarmTrigger OFF"
when
Item FFAlarmTrigger changed to OFF
then
postUpdate(FHZPush,"OFF")
postUpdate(FFAlarmView,"OFF")
end
rule "Fahrzeug Status 3"
rule "Alarmschleifen Auswertung"
when
Item FFAlarmSchleife received update
then
logInfo("Alarmschleife", "Alarmschleife wurde aktualisiert")
switch(FFAlarmSchleife.state.toString) {
case "57459": {
logInfo("Alarmschleife", "Vollalarm Rembrücken und Heusenstamm")
postUpdate(FFAlarmTrigger,"ON")
sendPushoverMessage(pushoverBuilder("Vollalarm Rembrücken und Heusenstamm").withSound("siren").withPriority(1))
}
case "57449": {
logInfo("Alarmschleife", "Einsatz für den ELW")
postUpdate(FFAlarmTrigger,"ON")
sendPushoverMessage(pushoverBuilder("Einsatz für den ELW").withSound("siren").withPriority(1))
}
case "57455": {
logInfo("Alarmschleife", "Vollalarm Rembrücken")
postUpdate(FFAlarmTrigger,"ON")
sendPushoverMessage(pushoverBuilder("Vollalarm Rembrücken").withSound("siren").withPriority(1))
}
}
end
rule "Push Fahrzeugstatus"
when
Member of gFHZ changed
then
@ -73,14 +101,18 @@ if (!lockState.isLocked) {
logInfo("Testing","gNetwork received update")
val member = gFHZ.members.filter[d | d.lastUpdate("jdbc") !== null].sortBy[lastUpdate("jdbc")].last
val name = member.label.toString
if (FFAlarmTrigger.state == ON && FHZPush.state == ON && member.state.toString == "3") {
if (FFAlarmTrigger.state == ON && member.state.toString == "3") {
logInfo("GroupTest", "Member "+ name +" to " + member.state )
sendPushoverMessage(pushoverBuilder(name + " ist aus zur E-Stelle").withSound("siren").withUser("upgb55kps8rx2xotn7dvdg3w2yjpt6"))
if (FHZPush.state == ON && member.state.toString == "3") {
sendPushoverMessage(pushoverBuilder(name + " ist aus zur E-Stelle").withSound("siren").withUser("upgb55kps8rx2xotn7dvdg3w2yjpt6"))
}
sendPushoverMessage(pushoverBuilder(name + " ist aus zur E-Stelle").withSound("siren").withUser("u8s32g4yym8xbk7yqn66cokjys13mf"))
}
if (FFAlarmTrigger.state == ON && FHZPush.state == ON && member.state.toString == "4") {
if (FFAlarmTrigger.state == ON && member.state.toString == "4") {
logInfo("GroupTest", "Member "+ name +" to " + member.state )
sendPushoverMessage(pushoverBuilder(name + " an der E-Stelle angekommen").withSound("siren").withUser("upgb55kps8rx2xotn7dvdg3w2yjpt6"))
if (FHZPush.state == ON && member.state.toString == "4") {
sendPushoverMessage(pushoverBuilder(name + " an der E-Stelle angekommen").withSound("siren").withUser("upgb55kps8rx2xotn7dvdg3w2yjpt6"))
}
sendPushoverMessage(pushoverBuilder(name + " an der E-Stelle angekommen").withSound("siren").withUser("u8s32g4yym8xbk7yqn66cokjys13mf"))
}
} finally {