diff --git a/testAlarms.txt b/testAlarms.txt deleted file mode 100644 index d855a78..0000000 --- a/testAlarms.txt +++ /dev/null @@ -1,18 +0,0 @@ -"25.7.2017 13:14:21","/Fritz-Haber-Institut/Bauteil R/Meldungen/Geb.R Meldungen","Geb.R Wasser-Sensor Lichtschacht Technikzentrale Keller ausgelst! -Quelle :DI_Wasser_Sensor_Lichtschacht_TZ -Besttigt :Nicht besttigt -Ausfhren :Besttigen -Kategorie :Heizung, Lftung, Klimatechnik - Allgemein -Aktueller Status :Unnormal" x x -"25.7.2017 12:24:37","/Fritz-Haber-Institut/Bauteil G/Kaltwasser/Umluftkhlwasser/Geb.G Umluftkhlwasser"xx,"Geb.G Umluftkhlwasser Sekundr Pumpe Ansteuerung Strung gehend. -Quelle :Geb.G KKUK Sekundr Pumpe Ansteuerung Strung -Besttigt :Nicht besttigt -Ausfhren :Besttigen -Kategorie :Heizung, Lftung, Klimatechnik - Allgemein -Aktueller Status :Normal"x x x -"25.7.2017 12:24:25","/Fritz-Haber-Institut/Bauteil G/Kaltwasser/Umluftkhlwasser/Geb.G Umluftkhlwasser"xx,"Geb.G Umluftkhlwasser Sekundr Pumpe Ansteuerung Strung! -Quelle :Geb.G KKUK Sekundr Pumpe Ansteuerung Strung -Besttigt :Nicht besttigt -Ausfhren :Besttigen -Kategorie :Heizung, Lftung, Klimatechnik - Allgemein -Aktueller Status :Unnormal"x x x diff --git a/testAlarms.txt b/testAlarms.txt new file mode 120000 index 0000000..e01f506 --- /dev/null +++ b/testAlarms.txt @@ -0,0 +1 @@ +testAlarmsUnnormal.txt \ No newline at end of file diff --git a/wc_checkAlarms.py b/wc_checkAlarms.py index d12113b..6cc5521 100644 --- a/wc_checkAlarms.py +++ b/wc_checkAlarms.py @@ -186,11 +186,11 @@ def main(args): print fault sys.exit(1) - #lines = report.split("\n") - #lines = lines[1:] + lines = report.split("\n") + lines = lines[1:] # Comment above two lines and uncomment below two lines in order to test the program - file = open("testAlarms.txt", "r") - lines = file.read().split("\n") + #file = open("testAlarms.txt", "r") + #lines = file.read().split("\n") # Go through the report and create alarm objects distinguishing by their current alarm status. # Start looping from the last line in order to process the oldest alarms first. @@ -240,7 +240,6 @@ def main(args): # the check/solution to a prior alarm with status e.g. 'unnormal': removedAlarm = False for a in alarmsActive: - if a.quelle == quelle: # Remove alarm from running and do not append to checked removedAlarm = True @@ -280,11 +279,12 @@ def main(args): if alarmsActive: for a in alarmsActive: - # Remove "Zombi alarms": - #if a.age == a.oldAge: + # Remove "Zombi alarms", that is, alarms that are still marked as active but do not appear in the retrieved + # alarms list anymore. So, these alarms were acknowledged/solved AND deleted between two alarms retrievals if not a.stillActive: - print("This alarm seems to have been solved and deleted so we're removing it from the list of active alarms:") - print(a) + if verbosity: + print("This alarm seems to have been solved and deleted so we're removing it from the list of active alarms:") + print(a.date, a.standort, a.message, a.quelle, a.bestaetigtVon, a.kategorie, a.status) alarmsActive.remove(a) continue