Merge pull request #378 from Schrolli91/pushover_ric

Pushover: Sep. Prio for RIC and ZVEI
This commit is contained in:
Bastian Schroll 2018-10-18 10:06:24 +02:00 committed by GitHub
commit 642b7e069e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 12 deletions

View file

@ -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

View file

@ -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%

View file

@ -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")