mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-05 06:25:10 +00:00
remove trailing whitespaces
to improve codacy rating
This commit is contained in:
parent
bf27623839
commit
77fb7fb44f
13 changed files with 97 additions and 100 deletions
|
|
@ -26,7 +26,7 @@ SET time_zone = "+00:00";
|
|||
--
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS boswatch;
|
||||
USE boswatch;
|
||||
USE boswatch;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
|
@ -121,11 +121,11 @@ INSERT INTO `bos_weblogin` (`id`, `user`, `password`, `isadmin`) VALUES (NULL, '
|
|||
--
|
||||
-- Schedule für Tabelle `bos_pocsag`
|
||||
--
|
||||
CREATE EVENT IF NOT EXISTS `Delete POCSAG Entries > 3 Months`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2016-01-01 00:00:00'
|
||||
ON COMPLETION PRESERVE ENABLE
|
||||
DO
|
||||
CREATE EVENT IF NOT EXISTS `Delete POCSAG Entries > 3 Months`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2016-01-01 00:00:00'
|
||||
ON COMPLETION PRESERVE ENABLE
|
||||
DO
|
||||
DELETE FROM bos_pocsag WHERE time < DATE_SUB(NOW(),INTERVAL 3 MONTH);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
|
@ -134,11 +134,11 @@ CREATE EVENT IF NOT EXISTS `Delete POCSAG Entries > 3 Months`
|
|||
-- Schedule für Tabelle `bos_fms`
|
||||
--
|
||||
|
||||
CREATE EVENT IF NOT EXISTS `Delete FMS Entries > 3 Months`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2016-01-01 00:00:00'
|
||||
ON COMPLETION PRESERVE ENABLE
|
||||
DO
|
||||
CREATE EVENT IF NOT EXISTS `Delete FMS Entries > 3 Months`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2016-01-01 00:00:00'
|
||||
ON COMPLETION PRESERVE ENABLE
|
||||
DO
|
||||
DELETE FROM bos_fms WHERE time < DATE_SUB(NOW(),INTERVAL 3 MONTH);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
|
@ -146,15 +146,15 @@ CREATE EVENT IF NOT EXISTS `Delete FMS Entries > 3 Months`
|
|||
--
|
||||
-- Schedule für Tabelle `bos_zvei`
|
||||
--
|
||||
|
||||
CREATE EVENT IF NOT EXISTS `Delete ZVEI Entries > 3 Months`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2016-01-01 00:00:00'
|
||||
ON COMPLETION PRESERVE ENABLE
|
||||
DO
|
||||
DELETE FROM bos_zvei WHERE time < DATE_SUB(NOW(),INTERVAL 3 MONTH);
|
||||
|
||||
|
||||
|
||||
CREATE EVENT IF NOT EXISTS `Delete ZVEI Entries > 3 Months`
|
||||
ON SCHEDULE EVERY 1 DAY
|
||||
STARTS '2016-01-01 00:00:00'
|
||||
ON COMPLETION PRESERVE ENABLE
|
||||
DO
|
||||
DELETE FROM bos_zvei WHERE time < DATE_SUB(NOW(),INTERVAL 3 MONTH);
|
||||
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@ Daten eintragen
|
|||
PIN-Abfrage deaktivieren mittels minicom
|
||||
minicom -D /dev/ttyUSB0
|
||||
ATI # alle infos
|
||||
|
||||
|
||||
AT+CLCK="SC",0,"0000" # 0000 = PIN
|
||||
AT+CLCK="SC",2 # Status-Check
|
||||
AT+CLCK="SC",2 # Status-Check
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
|
||||
"""
|
||||
This plugin enables the function of sendig SMS to
|
||||
This plugin enables the function of sendig SMS to
|
||||
a given number defined in config.ini
|
||||
It is sensitive to ric and subric, also defined in
|
||||
It is sensitive to ric and subric, also defined in
|
||||
config.ini
|
||||
|
||||
@author: Jens Herrmann
|
||||
|
|
@ -87,16 +87,16 @@ def run(typ,freq,data):
|
|||
if configHandler.checkConfig("SMS"): #read and debug the config (let empty if no config used)
|
||||
if typ == "POC": # only available for POC!
|
||||
logging.debug("Plugin SMS enabled")
|
||||
|
||||
|
||||
# get number of cases and build a RIC-Array
|
||||
i = globals.config.get("SMS","quantity")
|
||||
aRic = []
|
||||
|
||||
|
||||
# build the array
|
||||
for x in range (1, int(i) + 1):
|
||||
# check the number of subrics
|
||||
subric = globals.config.get("SMS","subric" + str(x))
|
||||
if len(subric) > 1: # we have more than one subric
|
||||
if len(subric) > 1: # we have more than one subric
|
||||
subric_list = subric.split(",")
|
||||
for y in range (0, len(subric_list)):
|
||||
sric = subric_list[y].replace(' ','')
|
||||
|
|
@ -112,37 +112,37 @@ def run(typ,freq,data):
|
|||
tmp.append(globals.config.get("SMS","ric" + str(x)) + subric)
|
||||
tmp.append(x)
|
||||
aRic.append(tmp) # 2D-Array...
|
||||
|
||||
|
||||
# Debug: Display the multidimensional array aRic
|
||||
#logging.debug("aRic: %s", aRic)
|
||||
|
||||
|
||||
target = data["ric"] + data["functionChar"]
|
||||
|
||||
|
||||
#logging.debug("Searching for any occurences of %s", target)
|
||||
#if target in aRic:
|
||||
try:
|
||||
index = find(aRic, target)
|
||||
except:
|
||||
logging.error("RIC not found")
|
||||
|
||||
|
||||
logging.debug("Return from find: %s", index)
|
||||
if index != -1:
|
||||
case = aRic[index[0]][1]
|
||||
logging.debug("Enabling case %s", case)
|
||||
|
||||
|
||||
text = globals.config.get("SMS","text" + str(case))
|
||||
number = globals.config.get("SMS","phonenumber" + str(case))
|
||||
|
||||
|
||||
#just for debug
|
||||
logging.debug("Aktivierter Text: %s", text)
|
||||
logging.debug("Aktivierte Nummer: %s", number)
|
||||
|
||||
|
||||
# send sms
|
||||
try:
|
||||
sm = gammu.StateMachine()
|
||||
sm.ReadConfig()
|
||||
sm.Init()
|
||||
|
||||
|
||||
message = {
|
||||
'Text': text,
|
||||
'SMSC': {'Location': 1},
|
||||
|
|
@ -153,7 +153,7 @@ def run(typ,freq,data):
|
|||
logging.error("Failed to send SMS")
|
||||
else:
|
||||
logging.debug("Falsche SUB-RIC entdeckt - weiter gehts!")
|
||||
|
||||
|
||||
else:
|
||||
logging.warning("Invalid Typ: %s", typ)
|
||||
########## User Plugin CODE ##########
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ def onLoad():
|
|||
BOTChatIDAPIKey = globals.config.get("Telegram","BOTChatIDAPIKey")
|
||||
RICforLocationAPIKey = globals.config.get("Telegram","RICforLocationAPIKey")
|
||||
GoogleAPIKey = globals.config.get("Telegram","GoogleAPIKey")
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ def run(typ,freq,data):
|
|||
@return: nothing
|
||||
@exception: nothing, make sure this function will never thrown an exception
|
||||
"""
|
||||
|
||||
|
||||
global BOTTokenKey
|
||||
global BOTChatIDAPIKey
|
||||
global RICforLocationAPIKey
|
||||
|
|
@ -83,17 +83,17 @@ def run(typ,freq,data):
|
|||
logging.debug("Compose output from POCSAG-message")
|
||||
# compose message content
|
||||
output = timeHandler.curtime()+"\n"+data["ric"]+"("+data["functionChar"]+")\n"+data["description"]+"\n"+data["msg"]
|
||||
|
||||
|
||||
# Initiate Telegram Bot
|
||||
logging.debug("Initiate Telegram BOT")
|
||||
bot = telegram.Bot(token='%s' % BOTTokenAPIKey)
|
||||
bot = telegram.Bot(token='%s' % BOTTokenAPIKey)
|
||||
|
||||
# Send message to chat via Telegram BOT API
|
||||
logging.debug("Send message to chat via Telegram BOT API")
|
||||
bot.sendMessage('%s' % BOTChatIDAPIKey, output)
|
||||
|
||||
# Generate location information only for specific RIC
|
||||
if data["ric"] == RICforLocationAPIKey:
|
||||
if data["ric"] == RICforLocationAPIKey:
|
||||
# Generate map
|
||||
logging.debug("Extract address from POCSAG message")
|
||||
address = "+".join(data["msg"].split(')')[0].split('/',1)[1].replace('(',' ').split())
|
||||
|
|
|
|||
|
|
@ -130,12 +130,12 @@ def run(typ,freq,data):
|
|||
subject = globals.config.get("eMail", "fms_subject")
|
||||
# replace wildcards with helper function
|
||||
subject = wildcardHandler.replaceWildcards(subject, data)
|
||||
|
||||
|
||||
# read mailtext-structure from config.ini
|
||||
mailtext = globals.config.get("eMail", "fms_message")
|
||||
# replace wildcards with helper function
|
||||
mailtext = wildcardHandler.replaceWildcards(mailtext, data, lineBrakeAllowed=True)
|
||||
|
||||
|
||||
# send eMail
|
||||
doSendmail(server, subject, mailtext)
|
||||
except:
|
||||
|
|
@ -150,12 +150,12 @@ def run(typ,freq,data):
|
|||
subject = globals.config.get("eMail", "zvei_subject")
|
||||
# replace wildcards with helper function
|
||||
subject = wildcardHandler.replaceWildcards(subject, data)
|
||||
|
||||
|
||||
# read mailtext-structure from config.ini
|
||||
mailtext = globals.config.get("eMail", "zvei_message")
|
||||
# replace wildcards with helper function
|
||||
mailtext = wildcardHandler.replaceWildcards(mailtext, data, lineBrakeAllowed=True)
|
||||
|
||||
|
||||
# send eMail
|
||||
doSendmail(server, subject, mailtext)
|
||||
except:
|
||||
|
|
@ -170,12 +170,12 @@ def run(typ,freq,data):
|
|||
subject = globals.config.get("eMail", "poc_subject")
|
||||
# replace wildcards with helper function
|
||||
subject = wildcardHandler.replaceWildcards(subject, data)
|
||||
|
||||
|
||||
# read mailtext-structure from config.ini
|
||||
mailtext = globals.config.get("eMail", "poc_message")
|
||||
# replace wildcards with helper function
|
||||
mailtext = wildcardHandler.replaceWildcards(mailtext, data, lineBrakeAllowed=True)
|
||||
|
||||
|
||||
# send eMail
|
||||
doSendmail(server, subject, mailtext)
|
||||
except:
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ def checkResponse(response, APIKey):
|
|||
except:
|
||||
logging.error("cannot read pynma response")
|
||||
logging.debug("cannot read pynma response", exc_info=True)
|
||||
return
|
||||
return
|
||||
|
||||
|
||||
##
|
||||
|
|
@ -90,7 +90,7 @@ def onLoad():
|
|||
global fmsAPIKeyList
|
||||
global zveiAPIKeyList
|
||||
global pocAPIKeyList
|
||||
|
||||
|
||||
# load config:
|
||||
configHandler.checkConfig("notifyMyAndroid")
|
||||
application = stringConverter.convertToUnicode(globals.config.get("notifyMyAndroid","appName"))
|
||||
|
|
@ -113,35 +113,35 @@ def onLoad():
|
|||
if row['typ'] in supportedTypes:
|
||||
try:
|
||||
if "FMS" in row['typ']:
|
||||
# if len for id in mainList raise an KeyErrorException, we have to init it...
|
||||
try:
|
||||
# if len for id in mainList raise an KeyErrorException, we have to init it...
|
||||
try:
|
||||
if len(fmsAPIKeyList[row['id']]) > 0:
|
||||
pass
|
||||
except KeyError:
|
||||
fmsAPIKeyList[row['id']] = []
|
||||
# data structure: fmsAPIKeyList[fms][i] = (APIKey, priority)
|
||||
fmsAPIKeyList[row['id']].append((row['APIKey'], row['priority'], row['eventPrefix']))
|
||||
|
||||
|
||||
elif "ZVEI" in row['typ']:
|
||||
# if len for id in mainList raise an KeyErrorException, we have to init it...
|
||||
try:
|
||||
# if len for id in mainList raise an KeyErrorException, we have to init it...
|
||||
try:
|
||||
if len(zveiAPIKeyList[row['id']]) > 0:
|
||||
pass
|
||||
except KeyError:
|
||||
zveiAPIKeyList[row['id']] = []
|
||||
# data structure: zveiAPIKeyList[zvei][i] = (APIKey, priority)
|
||||
zveiAPIKeyList[row['id']].append((row['APIKey'], row['priority'], row['eventPrefix']))
|
||||
|
||||
|
||||
elif "POC" in row['typ']:
|
||||
# if len for id in mainList raise an KeyErrorException, we have to init it...
|
||||
try:
|
||||
# if len for id in mainList raise an KeyErrorException, we have to init it...
|
||||
try:
|
||||
if len(pocAPIKeyList[row['id']]) > 0:
|
||||
pass
|
||||
except KeyError:
|
||||
pocAPIKeyList[row['id']] = []
|
||||
# data structure: zveiAPIKeyList[ric][i] = (APIKey, priority)
|
||||
pocAPIKeyList[row['id']].append((row['APIKey'], row['priority'], row['eventPrefix']))
|
||||
|
||||
|
||||
except:
|
||||
# skip entry in case of an exception
|
||||
logging.debug("error in shifting...", exc_info=True)
|
||||
|
|
@ -165,7 +165,7 @@ def onLoad():
|
|||
def run(typ,freq,data):
|
||||
"""
|
||||
This function is the implementation of the notifyMyAndroid-Plugin.
|
||||
|
||||
|
||||
The configuration is set in the config.ini.
|
||||
|
||||
@type typ: string (FMS|ZVEI|POC)
|
||||
|
|
@ -187,7 +187,7 @@ def run(typ,freq,data):
|
|||
global fmsAPIKeyList
|
||||
global zveiAPIKeyList
|
||||
global pocAPIKeyList
|
||||
|
||||
|
||||
try:
|
||||
try:
|
||||
#
|
||||
|
|
@ -199,7 +199,7 @@ def run(typ,freq,data):
|
|||
logging.debug("cannot initialize pyNMA", exc_info=True)
|
||||
# Without class, plugin couldn't work
|
||||
return
|
||||
|
||||
|
||||
else:
|
||||
# toDo is equals for all types, so only check if typ is supported
|
||||
supportedTypes = ["FMS", "ZVEI", "POC"]
|
||||
|
|
@ -213,7 +213,7 @@ def run(typ,freq,data):
|
|||
if ("POC" in typ) and (len(data['msg']) > 0):
|
||||
msg += "\n" + data['msg']
|
||||
msg = stringConverter.convertToUnicode(msg)
|
||||
|
||||
|
||||
# if not using csv-import, all is simple...
|
||||
if usecsv == False:
|
||||
response = nma.pushWithAPIKey(APIKey, application, event, msg, priority=globals.config.getint("notifyMyAndroid","priority"))
|
||||
|
|
@ -234,7 +234,7 @@ def run(typ,freq,data):
|
|||
except KeyError:
|
||||
# nothing found
|
||||
pass
|
||||
|
||||
|
||||
elif "ZVEI" in typ:
|
||||
# lets look for zvei in zveiAPIKeyList
|
||||
xID = data['zvei']
|
||||
|
|
@ -250,7 +250,7 @@ def run(typ,freq,data):
|
|||
except KeyError:
|
||||
# nothing found
|
||||
pass
|
||||
|
||||
|
||||
elif "POC" in typ:
|
||||
xID = ""
|
||||
# 1. lets look for ric+functionChar in pocAPIKeyList
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue