Initial Commit
This commit is contained in:
26
rules/Camera.rules
Normal file
26
rules/Camera.rules
Normal file
@ -0,0 +1,26 @@
|
||||
rule "Play Cam Sound"
|
||||
when
|
||||
Item CamPlaySound received update ON
|
||||
then
|
||||
logInfo("Play Cam Sound", "RULE GETRIGGERT: " + CamSoundLocSelection.state.toString)
|
||||
switch(CamSoundLocSelection.state.toString) {
|
||||
case "0": {
|
||||
logInfo("CamSoundLocSelection", "Nur vorne: " + CamSoundLocSelection.state.toString)
|
||||
sendHttpGetRequest("http://admin:rt8qff8ppkma82bzxq2vcy3m3@10.112.30.31/control/rcontrol?action=sound&soundfile="+CamSoundTone.state.toString+"&speakerlevel="+CamSoundVolume.state.toString+"")
|
||||
}
|
||||
case "1": {
|
||||
logInfo("CamSoundLocSelection", "Nur hinten: " + CamSoundLocSelection.state.toString)
|
||||
sendHttpGetRequest("http://admin:pdgqa62v4f4bd9trmvp7z7t88@10.112.30.32/control/rcontrol?action=sound&soundfile="+CamSoundTone.state.toString+"&speakerlevel="+CamSoundVolume.state.toString+"")
|
||||
}
|
||||
case "2": {
|
||||
logInfo("CamSoundLocSelection", "Vorne und hinten: " + CamSoundLocSelection.state.toString)
|
||||
sendHttpGetRequest("http://admin:rt8qff8ppkma82bzxq2vcy3m3@10.112.30.31/control/rcontrol?action=sound&soundfile="+CamSoundTone.state.toString+"&speakerlevel="+CamSoundVolume.state.toString+"")
|
||||
sendHttpGetRequest("http://admin:pdgqa62v4f4bd9trmvp7z7t88@10.112.30.32/control/rcontrol?action=sound&soundfile="+CamSoundTone.state.toString+"&speakerlevel="+CamSoundVolume.state.toString+"")
|
||||
}
|
||||
}
|
||||
// if (CamSoundLocSelection.state.toString == "3" )
|
||||
// sendHttpGetRequest("http://admin:rt8qff8ppkma82bzxq2vcy3m3@10.112.30.31/control/rcontrol?action=sound&soundfile=Cuckooclock")
|
||||
// sendHttpGetRequest("http://admin:pdgqa62v4f4bd9trmvp7z7t88@10.112.30.32/control/rcontrol?action=sound&soundfile=Cuckooclock&speakerlevel=30")
|
||||
// }
|
||||
|
||||
end
|
13
rules/Dienste.rules
Normal file
13
rules/Dienste.rules
Normal file
@ -0,0 +1,13 @@
|
||||
rule "DWD Warnungen"
|
||||
when
|
||||
//Time cron "0 */30 * ? * *" //every 30 Minutes
|
||||
Time cron "0 * * ? * *" //every 1 Minute
|
||||
then
|
||||
logInfo("HTTPGET", "Abfragr Erfolgt")
|
||||
var String jsonString = sendHttpGetRequest("https://fms.ffhstm.de/dienste_lesen_json.php")
|
||||
postUpdate(FFDienstZVD,transform("JSONPATH", "$.DIENSTE.C", jsonString))
|
||||
postUpdate(FFDienstIUK2,transform("JSONPATH", "$.DIENSTE.D", jsonString))
|
||||
// postUpdate(FFDienstIUK3,transform("JSONPATH", "$.DIENSTE.F", jsonString))
|
||||
postUpdate(FFDienstIUK3,transform("JSONPATH", "$.DIENSTE.E", jsonString))
|
||||
postUpdate(FFSperrungen,transform("JSONPATH", "$.SPERRUNG", jsonString))
|
||||
end
|
92
rules/FFRAlarm.rules
Normal file
92
rules/FFRAlarm.rules
Normal file
@ -0,0 +1,92 @@
|
||||
import java.util.concurrent.locks.ReentrantLock
|
||||
var ReentrantLock lockState = new ReentrantLock()
|
||||
var Timer FFAlarmTimer = null
|
||||
|
||||
rule "FFAlarmRuleJSON"
|
||||
when
|
||||
Item FFAlarmJSON changed
|
||||
then
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmEinsatznummer")
|
||||
postUpdate(FFAlarmEinsatznummer,transform("JSONPATH", "$.Einsatznummer", FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmOrt")
|
||||
postUpdate(FFAlarmOrt,transform("JSONPATH", "$.Ort", FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmOrtsteil")
|
||||
postUpdate(FFAlarmOrtsteil,transform("JSONPATH", "$.Ortsteil", FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmStrasse")
|
||||
postUpdate(FFAlarmStrasse,transform("JSONPATH","$.Strasse",FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmObjekt")
|
||||
postUpdate(FFAlarmObjekt,transform("JSONPATH","$.Objekt",FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmEStelleZusatz")
|
||||
// postUpdate(FFAlarmEStelleZusatz,transform("JSONPATH","$.E-Stelle-Zusatz",FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmEStelleBem")
|
||||
postUpdate(FFAlarmEStelleBem,transform("JSONPATH","$.E-Stelle-Bem",FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmKoordinate")
|
||||
postUpdate(FFAlarmKoordinate,transform("JSONPATH","$.Koordinate",FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmStichwort")
|
||||
postUpdate(FFAlarmStichwort,transform("JSONPATH","$.Stichwort",FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmMeldebild")
|
||||
postUpdate(FFAlarmMeldebild,transform("JSONPATH","$.Meldebild",FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmAlarmierungszeit")
|
||||
postUpdate(FFAlarmAlarmierungszeit,transform("JSONPATH", "$.Alarmierungszeit", FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmBemerkung")
|
||||
postUpdate(FFAlarmBemerkung,transform("JSONPATH","$.Bemerkung",FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmMeldender")
|
||||
postUpdate(FFAlarmMeldender,transform("JSONPATH", "$.Meldender", FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor FFAlarmEinsatzmittel")
|
||||
postUpdate(FFAlarmEinsatzmittel,transform("JSONPATH","$.Einsatzmittel",FFAlarmJSON.state.toString))
|
||||
logInfo("FFAlarmJSON","Vor ")
|
||||
postUpdate(FFAlarmTrigger,transform("JSONPATH","$.AlarmTrigger",FFAlarmJSON.state.toString))
|
||||
end
|
||||
|
||||
rule "FFAlarmTrigger OF"
|
||||
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
|
||||
]
|
||||
end
|
||||
|
||||
rule "FFAlarmTrigger OF"
|
||||
when
|
||||
Item FFAlarmTrigger changed to OFF
|
||||
then
|
||||
postUpdate(FHZPush,"OFF")
|
||||
end
|
||||
|
||||
rule "Fahrzeug Status 3"
|
||||
when
|
||||
Member of gFHZ changed
|
||||
then
|
||||
Thread::sleep(300)
|
||||
if (!lockState.isLocked) {
|
||||
lockState.lock()
|
||||
try {
|
||||
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") {
|
||||
logInfo("GroupTest", "Member "+ name +" to " + member.state )
|
||||
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") {
|
||||
logInfo("GroupTest", "Member "+ name +" to " + member.state )
|
||||
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 {
|
||||
lockState.unlock()
|
||||
}
|
||||
} else {
|
||||
logInfo("Testing","Locked, update ignored")
|
||||
}
|
||||
end
|
34
rules/Wetterwarnung.rules
Normal file
34
rules/Wetterwarnung.rules
Normal file
@ -0,0 +1,34 @@
|
||||
rule "DWD Warnungen"
|
||||
when
|
||||
// Time cron "0 */30 * ? * *" //every 30 Minutes
|
||||
Time cron "0 * * ? * *" //every 1 Minute
|
||||
then
|
||||
var String jsonString = sendHttpGetRequest("https://www.dwd.de/DWD/warnungen/warnapp/json/warnings.json")
|
||||
var String newString = transform("JS", "Wetter_DWD_getWarningsJSON.js", jsonString)
|
||||
if (newString !="NULL") {
|
||||
var String newStart = transform("JSONPATH", "$.start", newString)
|
||||
var DateTime timestart = new DateTime(Long::parseLong(newStart))
|
||||
DWD_Warnung_start.postUpdate(new DateTimeType(timestart.toString))
|
||||
var String newEnd = transform("JSONPATH", "$.end", newString)
|
||||
if (newEnd !==null) {
|
||||
var DateTime timeend = new DateTime(Long::parseLong(newEnd))
|
||||
DWD_Warnung_end.postUpdate(new DateTimeType(timeend.toString))
|
||||
}
|
||||
|
||||
DWD_Warnung_level.postUpdate(transform("JSONPATH","$.level",newString))
|
||||
DWD_Warnung_description.postUpdate(transform("JSONPATH","$.description",newString))
|
||||
DWD_Warnung_headline.postUpdate(transform("JSONPATH","$.headline",newString))
|
||||
DWD_Warnung_instruction.postUpdate(transform("JSONPATH","$.instruction",newString))
|
||||
DWD_Warnung_event.postUpdate(transform("JSONPATH","$.event",newString))
|
||||
}
|
||||
|
||||
if (newString =="NULL") {
|
||||
DWD_Warnung_start.postUpdate("NULL")
|
||||
DWD_Warnung_end.postUpdate("NULL")
|
||||
DWD_Warnung_level.postUpdate(0)
|
||||
DWD_Warnung_description.postUpdate("-")
|
||||
DWD_Warnung_headline.postUpdate("derzeit keine Warnungen")
|
||||
DWD_Warnung_instruction.postUpdate("-")
|
||||
DWD_Warnung_event.postUpdate("-")
|
||||
}
|
||||
end
|
5
rules/readme.txt
Normal file
5
rules/readme.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Your rules go here.
|
||||
All rule files have to have the ".rules" file extension and must follow a special syntax.
|
||||
|
||||
Check out the openHAB documentation for more details:
|
||||
https://www.openhab.org/docs/configuration/rules-dsl.html
|
Reference in New Issue
Block a user