diff --git a/CHANGELOG.md b/CHANGELOG.md index 62f0368..0e81d70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### __[v2.#]__ - Unreleased ##### Added +- Pushover-Plugin: Priorität für einzelne RIC und ZVEI in config einstellbar [#378](https://github.com/Schrolli91/BOSWatch/pull/378) ##### Changed ##### Deprecated ##### Removed diff --git a/config/config.template.ini b/config/config.template.ini index dd999a5..bda5904 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -349,11 +349,30 @@ SubA = 1 SubB = 1 SubC = 2 SubD = -2 + +# ...or define the priority depending on the RIC +# 1. switch it on +poc_spec_ric = 0 + +# 2. fill the following lists, seperator is , +poc_prio2 = +poc_prio1 = +poc_prio0 = + poc_title = Alarm: %RIC%%LPAR%%FUNCCHAR%%RPAR% poc_message = %DATE% %TIME% - %DESCR%: %MSG% # Section for ZVEI -zvei_prio = 1 +# default prio for all ZVEI - except you specify it different +zvei_std_prio = 1 + +# [1 - on, 0 - off] - by switching on you can list certain ZVEI depending on their priority +zvei_sep_prio = 0 + +# use the following lists, separator is , +zvei_prio2 = +zvei_prio1 = +zvei_prio0 = zvei_title = Alarm: %ZVEI% zvei_message = %DATE% %TIME%: %ZVEI% diff --git a/plugins/Pushover/Pushover.py b/plugins/Pushover/Pushover.py index d220de6..051445d 100644 --- a/plugins/Pushover/Pushover.py +++ b/plugins/Pushover/Pushover.py @@ -75,9 +75,20 @@ def run(typ, freq, data): # # building message for ZVEI # + if globalVars.config.get("Pushover", "zvei_sep_prio") == '1': + if data["zvei"] in globalVars.config.get("Pushover", "zvei_prio2"): + priority = '2' + elif data["zvei"] in globalVars.config.get("Pushover","zvei_prio1"): + priority = '1' + elif data["zvei"] in globalVars.config.get("Pushover","zvei_prio0"): + priority = '0' + else: + priority = '-1' + else: + priority = globalVars.config.get("Pushover","zvei_std_prio") + message = globalVars.config.get("Pushover", "zvei_message") title = globalVars.config.get("Pushover", "zvei_title") - priority = globalVars.config.get("Pushover", "zvei_prio") logging.debug("Sending message: %s", message) elif typ == "POC": @@ -86,17 +97,27 @@ def run(typ, freq, data): # Pushover-Request # logging.debug("send Pushover for %s", typ) - - if data["function"] == '1': - priority = globalVars.config.get("Pushover", "SubA") - elif data["function"] == '2': - priority = globalVars.config.get("Pushover", "SubB") - elif data["function"] == '3': - priority = globalVars.config.get("Pushover", "SubC") - elif data["function"] == '4': - priority = globalVars.config.get("Pushover", "SubD") + if globalVars.config.get("Pushover", "poc_spec_ric") == '0': + if data["function"] == '1': + priority = globalVars.config.get("Pushover", "SubA") + elif data["function"] == '2': + priority = globalVars.config.get("Pushover", "SubB") + elif data["function"] == '3': + priority = globalVars.config.get("Pushover", "SubC") + elif data["function"] == '4': + priority = globalVars.config.get("Pushover", "SubD") + else: + priority = 0 else: - priority = 0 + if data["ric"] in globalVars.config.get("Pushover", "poc_prio2"): + priority = 2 + elif data["ric"] in globalVars.config.get("Pushover","poc_prio1"): + priority = 1 + elif data["ric"] in globalVars.config.get("Pushover","poc_prio0"): + priority = 0 + else: + priority = -1 + message = globalVars.config.get("Pushover", "poc_message") title = globalVars.config.get("Pushover", "poc_title")