diff --git a/CHANGELOG.md b/CHANGELOG.md index d5c49c3e..b1cc352a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,28 @@ # Changelog +### __[v2.4.4]__ - unreleased +##### Added +- Divera-Plugin: Plugin zum Ansteuern der Divera-Api. [#415](https://github.com/Schrolli91/BOSWatch/pull/415) +- GPIO-Control: Plugin zum Ansteuern der GPIO Pins. [#438](https://github.com/Schrolli91/BOSWatch/pull/438) +##### Changed +- MySQL-Plugin: Index für die RIC Adresse hinzugefügt [#411](https://github.com/Schrolli91/BOSWatch/issues/411) +- MySQL-Plugin: INSERT Befehl für MySQL 8.x angepasst, Spaltennamen escaped [#410](https://github.com/Schrolli91/BOSWatch/issues/410) +- Pushover-Plugin: Konfigurationsmöglichkeit für den Sound [#418](https://github.com/Schrolli91/BOSWatch/issues/418) +##### Deprecated +##### Removed +##### Fixed +- Description-List: Buchstaben in FMS-Kennungen werden nun erkannt und zugelassen [#409](https://github.com/Schrolli91/BOSWatch/issues/409) +- MySQL-Plugin: Volle UTF-8 Kompatibilität für Datenbankstruktur, Verbindung und Darstellung im WebUI [#398](https://github.com/Schrolli91/BOSWatch/issues/398) +##### Security + ### __[v2.4.3]__ - 22.09.2019 ##### Added - Telegram-Plugin: In der generierten Übersichtkarte wird eine Anfahrtsroute integriert. Der Abfahrtsort ist konfiguierbar. [#382](https://github.com/Schrolli91/BOSWatch/pull/382) - Hue-Plugin: Geräte die mit einer Hue bridge verbunden sind können aus BOSWatch ein- und ausgeschaltet werden. [#394](https://github.com/Schrolli91/BOSWatch/issues/394) ##### Changed -- FFAgent Plugin: zusätzliches OrderedDict "alarmHeadersOrdered" implementiert um das HTTP Header Ordering sicherzustellen. Zusätzlich den HTTP Request mittels Session implementiert um das Header Ordering zu bewahren. Zusätzliches Debug Logging für die Header implementiert. [#356] (https://github.com/Schrolli91/BOSWatch/issues/356) -- POC-Decoder: Im POC-Text wird nach einem RegEx, welcher Koordinaten enthält, gesucht. Werden diese gefunden, so stehen zwei neu befüllte Data-Felder Lon bzw Lat zur Verfügung. +- FFAgent Plugin: zusätzliches OrderedDict "alarmHeadersOrdered" implementiert um das HTTP Header Ordering sicherzustellen. Zusätzlich den HTTP Request mittels Session implementiert um das Header Ordering zu bewahren. Zusätzliches Debug Logging für die Header implementiert. [#356](https://github.com/Schrolli91/BOSWatch/issues/356) +- POC-Decoder: Im POC-Text wird nach einem RegEx, welcher Koordinaten enthält, gesucht. Werden diese gefunden, so stehen zwei neu befüllte Data-Felder Lon bzw Lat zur Verfügung. [#405](https://github.com/Schrolli91/BOSWatch/pull/405) ##### Fixed - Asynchrone Alarme: Bei asynchroner Verarbeitung von schnell aufeinander folgenden Alarmen, wurde der Inhalt der Objekte typ, freq und data bereits vor dem Abschluss der Verarbeitung eines Alarms wieder überschrieben. Ergebnis hiervon war die Vermischung von RICs und Texten unterschiedlicher Alarme. Lösung über copy.deepcopy() [#394](https://github.com/Schrolli91/BOSWatch/issues/394) - POC-Decoder: Bug wegen nicht zugeweisener Variable 'has_geo' [#410](https://github.com/Schrolli91/BOSWatch/issues/413) [HOTFIX] diff --git a/config/config.template.ini b/config/config.template.ini index 9e056794..358fd182 100644 --- a/config/config.template.ini +++ b/config/config.template.ini @@ -1,513 +1,565 @@ - -# ____ ____ ______ __ __ __ -# / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ -# / __ / / / /\__ \| | /| / / __ / __/ ___/ __ \ -# / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / -# /_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ -# German BOS Information Script -# configuration file -# -# The intercept of the German BOS radio is strictly -# prohibited and will be prosecuted. -# The use is only authorized personnel permitted! -# - - -[BOSWatch] -# set loglevel for logfile -# 10 = debug -# 20 = info -# 30 = warning -# 40 = error -# 50 = critical -loglevel = 10 - -# BOSWatch uses a rotating logfile -# Rotating is at midnight -# You can set the backupCount here -# backupCount = 7 (keeps logfiles for 7 days) -backupCount = 7 - -# if you want to start BOSWatch as a daemon with rc2.d, -# you have to set the path to rtl_fm and multimon-ng ! -# both pathes have to end with an / -#rtl_path = /usr/local/bin/ -#multimon_path = /usr/local/bin/ - -# if you are using many plugins or plugins with a long execution time -# you can execute them in an asynchronous manner -# It must be pointed out that enabling (0|1) this consumes time, -# so don't use it for one rapid plugin -processAlarmAsync = 0 - -# Using RegEx-filter (0 - off | 1 - on) -# filter-configuration in section [Filters] -# if you are using the RegEx filter you must add filter rules to forward alarms -useRegExFilter = 0 - -# for double check save the last n IDs -# it is used in combination with double_ignore_time -# 1 is required if you want to use the double alarm filter -doubleFilter_ignore_entries = 10 - -# time to ignore same alarm (only ID is checked) (sec) -doubleFilter_ignore_time = 5 - -# ignore msg is only usefull for POCSAG (0 - off | 1 - on) -# 0: double check ignores the msg-text (only check ID + function) -# 1: if you want to differentiate between with/ without msg -# f.e. if they use quick-alarm (without text, then same RIC with msg) -# you will get more then one alarm anyway if the msg is different (receiving-problems) -doubleFilter_check_msg = 0 - -# writes the multimon-ng raw data stream into a text file named mm_raw.txt -writeMultimonRaw = 0 - - -[FMS] -# look-up-table for adding a description -# using description (0 - off | 1 - on) -# descriptions are loaded from csv/fms.csv -idDescribed = 0 - -# Check for correct CRC-information is provided by multimon-ng -# As this seems to be incorrect in many cases it might be useful to disable this -# (0 - off | 1 - on) -# Better use RegEX to verify the correct data -checkCRC = 0 - - -[ZVEI] -# look-up-table for adding a description -# using description (0 - off | 1 - on) -# descriptions are loaded from csv/zvei.csv -idDescribed = 0 - - -[POC] -# some very simple filters: -# Allow only this RICs (empty: allow all, separator ",") -# f.e.: allow_ric = 1234566,1234567,1234568 -allow_ric = - -# Deny this RICs (empty: allow all, separator ",") -# f.e.: deny_ric = 1234566,1234567,1234568 -deny_ric = - -# start and end of an allowed filter range -filter_range_start = 0000000 -filter_range_end = 9999999 - -# look-up-table for adding a description -# using description (0 - off | 1 - on) -# descriptions are loaded from csv/poc.csv -idDescribed = 0 - -# Static Massages for Subrics. -rica = Feuer -ricb = TH -ricc = AGT -ricd = Unwetter - -# RIC for net identification -# Usually sent periodically, separated by comma -netIdent_ric = 0174760, 1398098 -# you can hold one entry per netIdent_ric [0] or the whole history [1] -netIdent_history = 0 - -# With some message, coordinates can be sent to determine the destination -# Do you want to enable this feature? (0 - off | 1 - on) -geo_enable = 0 -# If a RIC contains coordinates, specify the regex used to decode them -geo_format = #C(\d{2})(\d{5}),(\d{2})(\d{5})# -geo_order = LON, lon, LAT, lat - - -[multicastAlarm] -# Configure multicastAlarm if your POCSAG network uses an optimized transmission scheme for alarms with more than one RIC (often found in Swissphone networks). -# In this optimized transmission scheme, a POCSAG telegram with each RIC that needs to be alarmed will be send in a sequence. These telegrams are send without a text message. This sequence is directly followed by a telegram with a specific RIC and the text message that belongs to the sequnece send right before. -# A POCSAG pager (DME) can be configured to start an acoustic alarm if a specific RIC without text has been received. If afterwards the specific RIC with the text message will be received, the pager will show the message in it's display. -# multicastAlarm enables BOSwatch to process the all received RICs joined with the text message. -# -# enable multicastAlarm (0 - off | 1 - on) -multicastAlarm = 0 - -# time limit for alarms that do not belong to the multicastAlarm sequence in seconds -multicastAlarm_ignore_time = 15 - -# multicastAlarm delimiter RIC (usually used as a starting point for a alarm sequence). Needs to be empty if multicastAlarms are interrupted by normal alarms. -multicastAlarm_delimiter_ric = - -# multicastAlarm RIC (one or more, separated by comma) used to send the text message -multicastAlarm_ric = - - -[Filters] -# RegEX Filter Configuration -# http://www.regexr.com/ - RegEX Test Tool an Documentation -# If RegEX is enabled - only alloewd data will pass! -# INDIVIDUAL_NAME = TYP;DATAFIELD;PLUGIN;FREQUENZ;REGEX -# TYP = the Data Typ (FMS|ZVEI|POC) -# DATAFIELD = the field of the Data Array (see readme.md in plugin folder) -# PLUGIN = the name of the Plugin to call with this Filter (* for all) -# FREQUENZ = the Frequenz to use the Filter (for more SDR Sticks (* for all)) -# REGEX = the RegEX - -# only ZVEI to all plugins with 25### at 85.5MHz -#testfilter = ZVEI;zvei;*;85500000;25[0-9]{3} - -# only POCSAG to MySQL with the text "ALARM:" in the message -#pocTest = POC;msg;MySQL;*;ALARM: - - -[Plugins] -# turn the plugins on or off (0 - off | 1 - on) -MySQL = 0 -httpRequest = 0 -eMail = 0 -BosMon = 0 -firEmergency = 0 -jsonSocket = 0 -SMS = 0 -Sms77 = 0 -FFAgent = 0 -Pushover = 0 -Telegram = 0 -yowsup = 0 -hue = 0 - -# for developing - template-module -template = 0 - - -[MySQL] -# MySQL configuration -#default port: 3306 -dbserver = localhost -dbport = 3306 -dbuser = boswatch -dbpassword = root -database = boswatch - -# tables in the database -tableFMS = bos_fms -tableZVEI = bos_zvei -tablePOC = bos_pocsag -tableSIG = bos_signal - - -[httpRequest] -# example URL http://example.com/remote.php?DESCR=%DESCR% - -# multiple URLs can be separated by comma - -# you can use the wildcards in your URL as GET params: -# http://en.wikipedia.org/wiki/Query_string - -#Wildcards can be used, see end of the file! -#fms_url = http://www.google.de?code=%FMS%&stat=%STATUS% -fms_url = - -#Wildcards can be used, see end of the file! -#zvei_url = http://www.google.de?zvei=%ZVEI% -zvei_url = - -#Wildcards can be used, see end of the file! -#poc_url = http://www.google.de?ric=%RIC%&subric=%FUNC%&msg=%MSG% -poc_url = - - -[eMail] -# SMTP-Server -smtp_server = localhost -# Port of SMTP-server (default: ) -smtp_port = -# use tls for connection (0|1) -tls = 0 -# Use this, when SMTP-server has restricted access -user = -password = - -# Parameters for Alarm-Msg: -# "to" can be more than one address, comma separated -from = local@localhost -to = user@irgendwo, user2@woanders - -# Priority of the eMail: -# normal|urgent|non-urgent -priority = urgent - -#Wildcards can be used, see end of the file! -fms_subject = FMS: %FMS% -fms_message = %DATE% %TIME%: %FMS%%BR%Status: %STATUS% - Direction: %DIRT% - TSI: %TSI% - -#Wildcards can be used, see end of the file! -zvei_subject = Alarm: %ZVEI% -zvei_message = %DATE% %TIME%: %ZVEI% - -#Wildcards can be used, see end of the file! -poc_subject = Alarm: %RIC%%LPAR%%FUNCCHAR%%RPAR% -poc_message = %DATE% %TIME% - %DESCR%: %MSG% - - -[BosMon] -# IP-address of the server (without http://) -# actually no SSL-support -bosmon_server = 192.168.0.1 -bosmon_port = 80 - -# channel-name of type "Web-Telegramm" -bosmon_channel = channel - -# Use this, when BosMon has restricted access -bosmon_user = -bosmon_password = - - -[firEmergency] -# firEmergency configuration -firserver = localhost -firport = 9001 - - -[jsonSocket] -# Protocol for socket (TCP|UDP) -protocol = UDP -# IP-address of the server (without http://) -server = 192.168.0.1 -port = 8888 - - -[SMS] -# be aware that you need 'gammu' installed and running -# at least you need an UMTS-stick which is supported by 'gammu' - -quantity = 1 -# be sensitive to single RIC -ric1 = 1234567 - -# but you can watch several subrics, comma-separated -subric1 = a, b - -# a single cellphone-number -phonenumber1 = 0160321654987 - -# and the text for the sms -# ! DO NOT USE ANY UMLAUT ! -text1 = Rueckruf Leitstelle! - - -[Sms77] -# SMS77 configuration -# Login Username -user = - -# Password or API Key -password = - -# Receiver singlenumber or groupname from adressbook -to = - -# Sender number or name -from = - -# Type of Message (see https://www.sms77.de/funktionen/smstypen and https://www.sms77.de/funktionen/http-api) -type = quality - - -[FFAgent] -# set live mode (0/1) -live = 0 - -# send messages as type test (0/1) -test = 1 - -# path to server certificate file -serverCertFile = - -# path to client certificate file (LIVE) -clientCertFile = - -# path to client certificate password file (LIVE) -clientCertPass = - -# webapi token -webApiToken = - -# webapi key -webApiKey = - -# access token -accessToken = - -# selective Call Code -selectiveCallCode = - - -[Pushover] -# Pushover API Key -api_key = - -# Pushover Userkey or Groupkey to receive message -user_key = - -# Section for POCSAG -# Adapt Pocsag Subric (a,b,c,d) to Pushover Priorities (see https://pushover.net/api#priority) -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 -# 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% - -# Section for FMS -fms_prio = 1 -fms_title = FMS: %FMS% -fms_message = %DATE% %TIME%: %FMS%%BR%Status: %STATUS% - Direction: %DIRT% - TSI: %TSI% %LPAR%%DESCR%%RPAR% - -# how often should Pushover re-alert in seconds (emergency-messages) -retry = 30 - -# when should Pushover stop to re-alert in seconds (emergency-messages) -expire = 90 - -# use HTML in messages (0/1) -html = 1 - - -[Telegram] -# This is your unique BOT token. You will get it from the BotFather once you have created your BOT. -BOTTokenAPIKey = -# Create a group chat with your BOT and enter the chat ID here. -# The plugin will send messages as your BOT and post everything in this group chat. -BOTChatIDAPIKey = -# The plugin can extract a location from the POCSAG message. -# However, this will be done for the following RIC only (7 digits e.g. 0012345). -RICforLocationAPIKey = -# This is your Google API key. -# Required if you want to create a map based on location information received with the above RIC. -GoogleAPIKey = -# Define your start address for the routing -# Use the following format: CityOfOrigin+Street+Number -RoutingOrigin = MyCity+MyStreet+MyNumber - -#Wildcards can be used, see end of the file! -FMS_message = %DATE% %TIME%: %FMS% - -#Wildcards can be used, see end of the file! -ZVEI_message = %DATE% %TIME%: %ZVEI% - -#Wildcards can be used, see end of the file! -POC_message = %MSG% - - -[yowsup] -# number or chat-number who whants to become the news -empfaenger = -# WhatsApp-number of that the news comes -sender = -# password from this number -password= - -#Wildcards can be used, see end of the file! -fms_message = %DATE% %TIME%: %FMS% - -#Wildcards can be used, see end of the file! -zvei_message = %DATE% %TIME%: %ZVEI% - -#Wildcards can be used, see end of the file! -poc_message = %MSG% - -[hue] -# For API access please read https://www.developers.meethue.com/documentation/getting-started (registration required) -# or https://www.google.com/search?q=philips+hue+how+to+get+api+key -# IP address of the hue bridge -bridgeip = - -# the numeric ID of the device (only one device supported) -deviceid = - -# the authentication string used to access the bridge -apikey = - -# Timing parameters for switching on/off -# Every on/off cycle adds delay to BOSwatch if it operates in synchronous mode. Consider to configure "processAlarmAsync = 1" to activate asynchronous operation in BOSwatch if you switch on/off multiple times. -# If a light bulb is connected, you can keep it blinking for a while -repeat = 2 -timeon = 2 -timeoff = 1 -# configure 0 to keep the switch on for infinite time or configure >=1 to keep it for the value in seconds to on, before switching to off. -keepon = 60 - -##################### -##### Not ready yet # -##################### - -[template] -test1 = testString -test2 = 123456 - - -##################### -##### WILDCARDS ##### -##################### - -##### FMS -# %FMS% = FMS Code -# %STATUS% = FMS Status -# %DIR% = Direction of the telegram (0/1) -# %DIRT% = Direction of the telegram (Text-String) -# %TSI% = Tactical Short Information (I-IV) -# %DESCR% = Description, if description-module is used -# %DATE% = Date (by script) -# %TIME% = Time (by script) -# %BR% = Insert line wrap (only in message) -# %LPAR% = ( -# %RPAR% = ) - -##### ZVEI -# %ZVEI% = ZVEI 5-tone Code -# %DESCR% = Description, if description-module is used -# %DATE% = Date (by script) -# %TIME% = Time (by script) -# %BR% = Insert line wrap (only in message) -# %LPAR% = ( -# %RPAR% = ) - -##### POCSAG -# %RIC% = POCSAG RIC -# %FUNC% = POCSAG function/Subric (1-4) -# %FUNCCHAR% = POCSAG function/Subric als character (a-d) -# %FUNCTEXT% = POCSAG static Subric message (see [POC]) -# %MSG% = Message of the POCSAG telegram -# %BITRATE% = Bitrate of the POCSAG telegram -# %DESCR% = Description, if description-module is used -# %DATE% = Date (by script) -# %TIME% = Time (by script) -# %BR% = Insert line wrap (only in message) -# %LPAR% = ( -# %RPAR% = ) + +# ____ ____ ______ __ __ __ +# / __ )/ __ \/ ___/ | / /___ _/ /______/ /_ +# / __ / / / /\__ \| | /| / / __ / __/ ___/ __ \ +# / /_/ / /_/ /___/ /| |/ |/ / /_/ / /_/ /__/ / / / +# /_____/\____//____/ |__/|__/\__,_/\__/\___/_/ /_/ +# German BOS Information Script +# configuration file +# +# The intercept of the German BOS radio is strictly +# prohibited and will be prosecuted. +# The use is only authorized personnel permitted! +# + + +[BOSWatch] +# set loglevel for logfile +# 10 = debug +# 20 = info +# 30 = warning +# 40 = error +# 50 = critical +loglevel = 10 + +# BOSWatch uses a rotating logfile +# Rotating is at midnight +# You can set the backupCount here +# backupCount = 7 (keeps logfiles for 7 days) +backupCount = 7 + +# if you want to start BOSWatch as a daemon with rc2.d, +# you have to set the path to rtl_fm and multimon-ng ! +# both pathes have to end with an / +#rtl_path = /usr/local/bin/ +#multimon_path = /usr/local/bin/ + +# if you are using many plugins or plugins with a long execution time +# you can execute them in an asynchronous manner +# It must be pointed out that enabling (0|1) this consumes time, +# so don't use it for one rapid plugin +processAlarmAsync = 0 + +# Using RegEx-filter (0 - off | 1 - on) +# filter-configuration in section [Filters] +# if you are using the RegEx filter you must add filter rules to forward alarms +useRegExFilter = 0 + +# for double check save the last n IDs +# it is used in combination with double_ignore_time +# 1 is required if you want to use the double alarm filter +doubleFilter_ignore_entries = 10 + +# time to ignore same alarm (only ID is checked) (sec) +doubleFilter_ignore_time = 5 + +# ignore msg is only usefull for POCSAG (0 - off | 1 - on) +# 0: double check ignores the msg-text (only check ID + function) +# 1: if you want to differentiate between with/ without msg +# f.e. if they use quick-alarm (without text, then same RIC with msg) +# you will get more then one alarm anyway if the msg is different (receiving-problems) +doubleFilter_check_msg = 0 + +# writes the multimon-ng raw data stream into a text file named mm_raw.txt +writeMultimonRaw = 0 + + +[FMS] +# look-up-table for adding a description +# using description (0 - off | 1 - on) +# descriptions are loaded from csv/fms.csv +idDescribed = 0 + +# Check for correct CRC-information is provided by multimon-ng +# As this seems to be incorrect in many cases it might be useful to disable this +# (0 - off | 1 - on) +# Better use RegEX to verify the correct data +checkCRC = 0 + + +[ZVEI] +# look-up-table for adding a description +# using description (0 - off | 1 - on) +# descriptions are loaded from csv/zvei.csv +idDescribed = 0 + + +[POC] +# some very simple filters: +# Allow only this RICs (empty: allow all, separator ",") +# f.e.: allow_ric = 1234566,1234567,1234568 +allow_ric = + +# Deny this RICs (empty: allow all, separator ",") +# f.e.: deny_ric = 1234566,1234567,1234568 +deny_ric = + +# start and end of an allowed filter range +filter_range_start = 0000000 +filter_range_end = 9999999 + +# look-up-table for adding a description +# using description (0 - off | 1 - on) +# descriptions are loaded from csv/poc.csv +idDescribed = 0 + +# Static Massages for Subrics. +rica = Feuer +ricb = TH +ricc = AGT +ricd = Unwetter + +# RIC for net identification +# Usually sent periodically, separated by comma +netIdent_ric = 0174760, 1398098 +# you can hold one entry per netIdent_ric [0] or the whole history [1] +netIdent_history = 0 + +# With some message, coordinates can be sent to determine the destination +# Do you want to enable this feature? (0 - off | 1 - on) +geo_enable = 0 +# If a RIC contains coordinates, specify the regex used to decode them +geo_format = #C(\d{2})(\d{5}),(\d{2})(\d{5})# +geo_order = LON, lon, LAT, lat + + +[multicastAlarm] +# Configure multicastAlarm if your POCSAG network uses an optimized transmission scheme for alarms with more than one RIC (often found in Swissphone networks). +# In this optimized transmission scheme, a POCSAG telegram with each RIC that needs to be alarmed will be send in a sequence. These telegrams are send without a text message. This sequence is directly followed by a telegram with a specific RIC and the text message that belongs to the sequnece send right before. +# A POCSAG pager (DME) can be configured to start an acoustic alarm if a specific RIC without text has been received. If afterwards the specific RIC with the text message will be received, the pager will show the message in it's display. +# multicastAlarm enables BOSwatch to process the all received RICs joined with the text message. +# +# enable multicastAlarm (0 - off | 1 - on) +multicastAlarm = 0 + +# time limit for alarms that do not belong to the multicastAlarm sequence in seconds +multicastAlarm_ignore_time = 15 + +# multicastAlarm delimiter RIC (usually used as a starting point for a alarm sequence). Needs to be empty if multicastAlarms are interrupted by normal alarms. +multicastAlarm_delimiter_ric = + +# multicastAlarm RIC (one or more, separated by comma) used to send the text message +multicastAlarm_ric = + + +[Filters] +# RegEX Filter Configuration +# http://www.regexr.com/ - RegEX Test Tool an Documentation +# If RegEX is enabled - only alloewd data will pass! +# INDIVIDUAL_NAME = TYP;DATAFIELD;PLUGIN;FREQUENZ;REGEX +# TYP = the Data Typ (FMS|ZVEI|POC) +# DATAFIELD = the field of the Data Array (see readme.md in plugin folder) +# PLUGIN = the name of the Plugin to call with this Filter (* for all) +# FREQUENZ = the Frequenz to use the Filter (for more SDR Sticks (* for all)) +# REGEX = the RegEX + +# only ZVEI to all plugins with 25### at 85.5MHz +#testfilter = ZVEI;zvei;*;85500000;25[0-9]{3} + +# only POCSAG to MySQL with the text "ALARM:" in the message +#pocTest = POC;msg;MySQL;*;ALARM: + + +[Plugins] +# turn the plugins on or off (0 - off | 1 - on) +MySQL = 0 +httpRequest = 0 +eMail = 0 +BosMon = 0 +firEmergency = 0 +jsonSocket = 0 +SMS = 0 +Sms77 = 0 +FFAgent = 0 +Pushover = 0 +Telegram = 0 +yowsup = 0 +hue = 0 +Divera = 0 +gpiocontrol = 0 + +# for developing - template-module +template = 0 + + +[MySQL] +# MySQL configuration +#default port: 3306 +dbserver = localhost +dbport = 3306 +dbuser = boswatch +dbpassword = root +database = boswatch + +# tables in the database +tableFMS = bos_fms +tableZVEI = bos_zvei +tablePOC = bos_pocsag +tableSIG = bos_signal + + +[httpRequest] +# example URL http://example.com/remote.php?DESCR=%DESCR% + +# multiple URLs can be separated by comma + +# you can use the wildcards in your URL as GET params: +# http://en.wikipedia.org/wiki/Query_string + +#Wildcards can be used, see end of the file! +#fms_url = http://www.google.de?code=%FMS%&stat=%STATUS% +fms_url = + +#Wildcards can be used, see end of the file! +#zvei_url = http://www.google.de?zvei=%ZVEI% +zvei_url = + +#Wildcards can be used, see end of the file! +#poc_url = http://www.google.de?ric=%RIC%&subric=%FUNC%&msg=%MSG% +poc_url = + + +[eMail] +# SMTP-Server +smtp_server = localhost +# Port of SMTP-server (default: ) +smtp_port = +# use tls for connection (0|1) +tls = 0 +# Use this, when SMTP-server has restricted access +user = +password = + +# Parameters for Alarm-Msg: +# "to" can be more than one address, comma separated +from = local@localhost +to = user@irgendwo, user2@woanders + +# Priority of the eMail: +# normal|urgent|non-urgent +priority = urgent + +#Wildcards can be used, see end of the file! +fms_subject = FMS: %FMS% +fms_message = %DATE% %TIME%: %FMS%%BR%Status: %STATUS% - Direction: %DIRT% - TSI: %TSI% + +#Wildcards can be used, see end of the file! +zvei_subject = Alarm: %ZVEI% +zvei_message = %DATE% %TIME%: %ZVEI% + +#Wildcards can be used, see end of the file! +poc_subject = Alarm: %RIC%%LPAR%%FUNCCHAR%%RPAR% +poc_message = %DATE% %TIME% - %DESCR%: %MSG% + + +[BosMon] +# IP-address of the server (without http://) +# actually no SSL-support +bosmon_server = 192.168.0.1 +bosmon_port = 80 + +# channel-name of type "Web-Telegramm" +bosmon_channel = channel + +# Use this, when BosMon has restricted access +bosmon_user = +bosmon_password = + + +[firEmergency] +# firEmergency configuration +firserver = localhost +firport = 9001 + + +[jsonSocket] +# Protocol for socket (TCP|UDP) +protocol = UDP +# IP-address of the server (without http://) +server = 192.168.0.1 +port = 8888 + + +[SMS] +# be aware that you need 'gammu' installed and running +# at least you need an UMTS-stick which is supported by 'gammu' + +quantity = 1 +# be sensitive to single RIC +ric1 = 1234567 + +# but you can watch several subrics, comma-separated +subric1 = a, b + +# a single cellphone-number +phonenumber1 = 0160321654987 + +# and the text for the sms +# ! DO NOT USE ANY UMLAUT ! +text1 = Rueckruf Leitstelle! + + +[Sms77] +# SMS77 configuration +# Login Username +user = + +# Password or API Key +password = + +# Receiver singlenumber or groupname from adressbook +to = + +# Sender number or name +from = + +# Type of Message (see https://www.sms77.de/funktionen/smstypen and https://www.sms77.de/funktionen/http-api) +type = quality + + +[FFAgent] +# set live mode (0/1) +live = 0 + +# send messages as type test (0/1) +test = 1 + +# path to server certificate file +serverCertFile = + +# path to client certificate file (LIVE) +clientCertFile = + +# path to client certificate password file (LIVE) +clientCertPass = + +# webapi token +webApiToken = + +# webapi key +webApiKey = + +# access token +accessToken = + +# selective Call Code +selectiveCallCode = + + +[Pushover] +# Pushover API Key +api_key = + +# Pushover Userkey or Groupkey to receive message +user_key = + +# Pushover Sound +sound = + +# Section for POCSAG +# Adapt Pocsag Subric (a,b,c,d) to Pushover Priorities (see https://pushover.net/api#priority) +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 +# 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% + +# Section for FMS +fms_prio = 1 +fms_title = FMS: %FMS% +fms_message = %DATE% %TIME%: %FMS%%BR%Status: %STATUS% - Direction: %DIRT% - TSI: %TSI% %LPAR%%DESCR%%RPAR% + +# how often should Pushover re-alert in seconds (emergency-messages) +retry = 30 + +# when should Pushover stop to re-alert in seconds (emergency-messages) +expire = 90 + +# use HTML in messages (0/1) +html = 1 + + +[Telegram] +# This is your unique BOT token. You will get it from the BotFather once you have created your BOT. +BOTTokenAPIKey = +# Create a group chat with your BOT and enter the chat ID here. +# The plugin will send messages as your BOT and post everything in this group chat. +BOTChatIDAPIKey = +# The plugin can extract a location from the POCSAG message. +# However, this will be done for the following RIC only (7 digits e.g. 0012345). +RICforLocationAPIKey = +# This is your Google API key. +# Required if you want to create a map based on location information received with the above RIC. +GoogleAPIKey = +# Define your start address for the routing +# Use the following format: CityOfOrigin+Street+Number +RoutingOrigin = MyCity+MyStreet+MyNumber + +#Wildcards can be used, see end of the file! +FMS_message = %DATE% %TIME%: %FMS% + +#Wildcards can be used, see end of the file! +ZVEI_message = %DATE% %TIME%: %ZVEI% + +#Wildcards can be used, see end of the file! +POC_message = %MSG% + + +[yowsup] +# number or chat-number who whants to become the news +empfaenger = +# WhatsApp-number of that the news comes +sender = +# password from this number +password= + +#Wildcards can be used, see end of the file! +fms_message = %DATE% %TIME%: %FMS% + +#Wildcards can be used, see end of the file! +zvei_message = %DATE% %TIME%: %ZVEI% + +#Wildcards can be used, see end of the file! +poc_message = %MSG% + + +[hue] +# For API access please read https://www.developers.meethue.com/documentation/getting-started (registration required) +# or https://www.google.com/search?q=philips+hue+how+to+get+api+key +# IP address of the hue bridge +bridgeip = + +# the numeric ID of the device (only one device supported) +deviceid = + +# the authentication string used to access the bridge +apikey = + +# Timing parameters for switching on/off +# Every on/off cycle adds delay to BOSwatch if it operates in synchronous mode. Consider to configure "processAlarmAsync = 1" to activate asynchronous operation in BOSwatch if you switch on/off multiple times. +# If a light bulb is connected, you can keep it blinking for a while +repeat = 2 +timeon = 2 +timeoff = 1 +# configure 0 to keep the switch on for infinite time or configure >=1 to keep it for the value in seconds to on, before switching to off. +keepon = 60 + + +[Divera] +# See https://api.divera247.com/ for Api-Documentation +# Title: Alarm-Stichwort (max. 50 Zeichen, in der kostenlosen Version max. 30 Zeichen) +# Text: Alarm-Text (in der kostenlosen Version wird dies nicht übernommen) +# Priority: true / false. +# Wird ein anderer Wert oder gar keiner gesetzt, so wird die Divera-Alarmierung nicht durchgeführt. + +# Divera API Key +accesskey = + +# Section for POCSAG +# Adapt Pocsag Subric (a,b,c,d) to Divera Priorities (true/false) +SubA = true +SubB = false +SubC = +SubD = + +poc_title = %DESCR%: %MSG% +poc_text = %DATE% %TIME% - %DESCR%: %MSG% + +# Section for ZVEI +# default prio for all ZVEI - except you specify it different +zvei_prio = true +zvei_title = Alarm: %ZVEI% +zvei_text = %DATE% %TIME%: %ZVEI% + +# Section for FMS +fms_prio = true +fms_title = FMS: %FMS% +fms_text = %DATE% %TIME%: %FMS%%BR%Status: %STATUS% - Direction: %DIRT% - TSI: %TSI% %LPAR%%DESCR%%RPAR% + + +[gpiocontrol] +#Pin that will be triggered +#Only tested on Raspberry Pi 3 +pin = 21 + +#Time the Pin will be triggered (in Seconds) +triggertime = 180 + +#ONLY POC +#POC Rics that trigger PIN (empty: allow all, separator ",") +activerics = 1234567,1234568 + + +##################### +##### Not ready yet # +##################### + +[template] +test1 = testString +test2 = 123456 + + +##################### +##### WILDCARDS ##### +##################### + +##### FMS +# %FMS% = FMS Code +# %STATUS% = FMS Status +# %DIR% = Direction of the telegram (0/1) +# %DIRT% = Direction of the telegram (Text-String) +# %TSI% = Tactical Short Information (I-IV) +# %DESCR% = Description, if description-module is used +# %DATE% = Date (by script) +# %TIME% = Time (by script) +# %BR% = Insert line wrap (only in message) +# %LPAR% = ( +# %RPAR% = ) + +##### ZVEI +# %ZVEI% = ZVEI 5-tone Code +# %DESCR% = Description, if description-module is used +# %DATE% = Date (by script) +# %TIME% = Time (by script) +# %BR% = Insert line wrap (only in message) +# %LPAR% = ( +# %RPAR% = ) + +##### POCSAG +# %RIC% = POCSAG RIC +# %FUNC% = POCSAG function/Subric (1-4) +# %FUNCCHAR% = POCSAG function/Subric als character (a-d) +# %FUNCTEXT% = POCSAG static Subric message (see [POC]) +# %MSG% = Message of the POCSAG telegram +# %BITRATE% = Bitrate of the POCSAG telegram +# %DESCR% = Description, if description-module is used +# %DATE% = Date (by script) +# %TIME% = Time (by script) +# %BR% = Insert line wrap (only in message) +# %LPAR% = ( +# %RPAR% = ) diff --git a/exampleAddOns/simpleWeb/mysql.class.php b/exampleAddOns/simpleWeb/mysql.class.php index a74b4b6e..8aa14456 100644 --- a/exampleAddOns/simpleWeb/mysql.class.php +++ b/exampleAddOns/simpleWeb/mysql.class.php @@ -35,6 +35,10 @@ function __construct($host, $user, $password, $database, $show_error = 1) $this->error("Datenbank nicht gefunden!", mysqli_error($this->conn)); return false; } + + /* Set character set for database connection to utf8mb4 */ + mysqli_query($this->conn, "SET NAMES 'utf8mb4'"); + return true; } diff --git a/includes/descriptionList.py b/includes/descriptionList.py index 9e548fd9..11281fd5 100644 --- a/includes/descriptionList.py +++ b/includes/descriptionList.py @@ -43,7 +43,7 @@ def loadCSV(typ, idField): for row in reader: logging.debug(row) # only import rows with an integer as id, allow subrics though - if re.match("^[0-9]+[A-D]?$", row[idField], re.IGNORECASE): + if re.match("^[0-9A-F]+$", row[idField], re.IGNORECASE): try: resultList[row[idField].lower()] = stringConverter.convertToUTF8(row['description']) except: @@ -102,7 +102,7 @@ def getDescription(typ, data): @return: description as string """ - resultStr = data; + resultStr = data logging.debug("look up description lists") try: if typ == "FMS": diff --git a/includes/globalVars.py b/includes/globalVars.py index 3f197cb4..d0edd2aa 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,9 +9,9 @@ """ # version info -versionNr = "2.4.3" -branch = "master" -buildDate = "22.09.2019" +versionNr = "2.4.4" +branch = "dev" +buildDate = "unreleased" # Global variables config = 0 diff --git a/plugins/Divera/Divera.py b/plugins/Divera/Divera.py new file mode 100644 index 00000000..60092ed5 --- /dev/null +++ b/plugins/Divera/Divera.py @@ -0,0 +1,153 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +""" +Divera-Plugin to send FMS-, ZVEI- and POCSAG - messages to Divera +@author: Marco Grosjohann +@requires: Divera-Configuration has to be set in the config.ini +""" + +import logging # Global logger +import httplib # for the HTTP request +import urllib +from includes import globalVars # Global variables + +# from includes.helper import timeHandler +from includes.helper import configHandler +from includes.helper import wildcardHandler + + +## +# +# onLoad (init) function of plugin +# will be called one time by the pluginLoader on start +# +def onLoad(): + """ + While loading the plugins by pluginLoader.loadPlugins() + this onLoad() routine is called one time for initialize the plugin + @requires: nothing + @return: nothing + """ + # nothing to do for this plugin + return + + +## +# +# Main function of Divera-plugin +# will be called by the alarmHandler +# +def run(typ, freq, data): + """ + This function is the implementation of the Divera-Plugin. + It will send the data to Divera API + @type typ: string (FMS|ZVEI|POC) + @param typ: Typ of the dataset + @type data: map of data (structure see readme.md in plugin folder) + @param data: Contains the parameter + @type freq: string + @keyword freq: frequency of the SDR Stick + @requires: Divera-Configuration has to be set in the config.ini + @return: nothing + """ + try: + if configHandler.checkConfig("Divera"): # read and debug the config + + if typ == "FMS": + # + # building message for FMS + # + text = globalVars.config.get("Divera", "fms_text") + title = globalVars.config.get("Divera", "fms_title") + priority = globalVars.config.get("Divera", "fms_prio") + + elif typ == "ZVEI": + # + # building message for ZVEI + # + text = globalVars.config.get("Divera", "zvei_text") + title = globalVars.config.get("Divera", "zvei_title") + priority = globalVars.config.get("Divera","zvei_std_prio") + + elif typ == "POC": + # + # building message for POC + # + if data["function"] == '1': + priority = globalVars.config.get("Divera", "SubA") + elif data["function"] == '2': + priority = globalVars.config.get("Divera", "SubB") + elif data["function"] == '3': + priority = globalVars.config.get("Divera", "SubC") + elif data["function"] == '4': + priority = globalVars.config.get("Divera", "SubD") + else: + priority = '' + + text = globalVars.config.get("Divera", "poc_text") + title = globalVars.config.get("Divera", "poc_title") + + else: + logging.warning("Invalid type: %s", typ) + return + + try: + # + # Divera-Request + # + logging.debug("send Divera for %s", typ) + + # replace the wildcards + text = wildcardHandler.replaceWildcards(text, data) + title = wildcardHandler.replaceWildcards(title, data) + + # Logging data to send + logging.debug("Title : %s", title) + logging.debug("Text : %s", text) + logging.debug("Priority: %s", priority) + + # check priority value + if (priority != 'false') and (priority != 'true'): + logging.info("No Priority set for type '%s'! Skipping Divera-Alarm!", typ) + return + + # start the connection + conn = httplib.HTTPSConnection("www.divera247.com:443") + conn.request("GET", "/api/alarm", + urllib.urlencode({ + "accesskey": globalVars.config.get("Divera", "accesskey"), + "title": title, + "text": text, + "priority": priority, + })) + + except: + logging.error("cannot send Divera request") + logging.debug("cannot send Divera request", exc_info=True) + return + + try: + # + # check Divera-Response + # + response = conn.getresponse() + if str(response.status) == "200": # Check Divera Response and print a Log or Error + logging.debug("Divera response: %s - %s", str(response.status), str(response.reason)) + else: + logging.warning("Divera response: %s - %s", str(response.status), str(response.reason)) + except: # otherwise + logging.error("cannot get Divera response") + logging.debug("cannot get Divera response", exc_info=True) + return + + finally: + logging.debug("close Divera-Connection") + try: + request.close() + except: + pass + + except: + logging.error("unknown error") + logging.debug("unknown error", exc_info=True) diff --git a/plugins/MySQL/MySQL.py b/plugins/MySQL/MySQL.py index c38410f1..04a8d08e 100644 --- a/plugins/MySQL/MySQL.py +++ b/plugins/MySQL/MySQL.py @@ -91,7 +91,7 @@ def run(typ,freq,data): # Connect to MySQL # logging.debug("connect to MySQL") - connection = mysql.connector.connect(host = globalVars.config.get("MySQL","dbserver"), port = globalVars.config.get("MySQL","dbport"), user = globalVars.config.get("MySQL","dbuser"), passwd = globalVars.config.get("MySQL","dbpassword"), db = globalVars.config.get("MySQL","database"), charset='utf8') + connection = mysql.connector.connect(host = globalVars.config.get("MySQL","dbserver"), port = globalVars.config.get("MySQL","dbport"), user = globalVars.config.get("MySQL","dbuser"), passwd = globalVars.config.get("MySQL","dbpassword"), db = globalVars.config.get("MySQL","database"), charset='utf8mb4') cursor = connection.cursor() except: logging.error("cannot connect to MySQL") @@ -104,21 +104,21 @@ def run(typ,freq,data): logging.debug("Insert %s", typ) if typ == "FMS": - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableFMS")+" (time, fms, status, direction, directionText, tsi, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["fms"], data["status"], data["direction"], data["directionText"], data["tsi"], data["description"])) + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableFMS")+" (`time`, `fms`, `status`, `direction`, `directionText`, `tsi`, `description`) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["fms"], data["status"], data["direction"], data["directionText"], data["tsi"], data["description"])) elif typ == "ZVEI": - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableZVEI")+" (time, zvei, description) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"])) + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableZVEI")+" (`time`, `zvei`, `description`) VALUES (FROM_UNIXTIME(%s),%s,%s)", (data["timestamp"], data["zvei"], data["description"])) elif typ == "POC": if isSignal(data["ric"]): if globalVars.config.getint("POC","netIdent_history"): - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (`time`,`ric`) VALUES (NOW(), '"+data["ric"]+"');") else: cursor.execute("UPDATE "+globalVars.config.get("MySQL","tableSIG")+" SET time = NOW() WHERE ric = '"+data["ric"]+"';") if cursor.rowcount == 0: - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (time,ric) VALUES (NOW(), '"+data["ric"]+"');") + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tableSIG")+" (`time`,`ric`) VALUES (NOW(), '"+data["ric"]+"');") else: - cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (time, ric, function, functionChar, msg, bitrate, description) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"])) + cursor.execute("INSERT INTO "+globalVars.config.get("MySQL","tablePOC")+" (`time`, `ric`, `function`, `functionChar`, `msg`, `bitrate`, `description`) VALUES (FROM_UNIXTIME(%s),%s,%s,%s,%s,%s,%s)", (data["timestamp"], data["ric"], data["function"], data["functionChar"], data["msg"], data["bitrate"], data["description"])) else: logging.warning("Invalid Typ: %s", typ) diff --git a/plugins/MySQL/boswatch.sql b/plugins/MySQL/boswatch.sql index 6f938610..cd044a8c 100644 --- a/plugins/MySQL/boswatch.sql +++ b/plugins/MySQL/boswatch.sql @@ -17,7 +17,7 @@ SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; -- -------------------------------------------------------- @@ -25,8 +25,8 @@ SET time_zone = "+00:00"; -- Datenbank anlegen `boswatch` -- -CREATE DATABASE IF NOT EXISTS boswatch; -USE boswatch; +CREATE DATABASE IF NOT EXISTS 'boswatch' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +USE 'boswatch'; -- -------------------------------------------------------- @@ -53,7 +53,7 @@ CREATE TABLE IF NOT EXISTS `bos_fms` ( `tsi` VARCHAR(3) NOT NULL, `description` TEXT NOT NULL, PRIMARY KEY (`ID`) -) ENGINE=MYISAM DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1; +) ENGINE=MYISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1; -- -------------------------------------------------------- @@ -70,8 +70,9 @@ CREATE TABLE IF NOT EXISTS `bos_pocsag` ( `msg` TEXT NOT NULL, `bitrate` INT(4) NOT NULL, `description` TEXT NOT NULL, - PRIMARY KEY (`ID`) -) ENGINE=MYISAM DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1; + PRIMARY KEY (`ID`), + KEY `POCSAG_RIC_IDX` (`ric`) +) ENGINE=MYISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1; -- rename old columns including little error-prevention #ALTER IGNORE TABLE `bos_pocsag` change `funktion` `function` INT(1); @@ -89,7 +90,7 @@ CREATE TABLE IF NOT EXISTS `bos_zvei` ( `zvei` VARCHAR(5) NOT NULL DEFAULT '0', `description` TEXT NOT NULL, PRIMARY KEY (`ID`) -) ENGINE=MYISAM DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1; +) ENGINE=MYISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1; -- -------------------------------------------------------- @@ -102,7 +103,7 @@ CREATE TABLE IF NOT EXISTS `bos_signal` ( `time` DATETIME NOT NULL, `ric` VARCHAR(7) NOT NULL DEFAULT '0', PRIMARY KEY (`ID`) -) ENGINE=MYISAM DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1; +) ENGINE=MYISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci AUTO_INCREMENT=1; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/plugins/Pushover/Pushover.py b/plugins/Pushover/Pushover.py index 051445d9..4d65785c 100644 --- a/plugins/Pushover/Pushover.py +++ b/plugins/Pushover/Pushover.py @@ -128,6 +128,10 @@ def run(typ, freq, data): # replace the wildcards message = wildcardHandler.replaceWildcards(message, data) title = wildcardHandler.replaceWildcards(title, data) + sound = globalVars.config.get("Pushover", "sound") + # set Default-Sound + if not sound: + sound = "pushover" # start the connection conn = httplib.HTTPSConnection("api.pushover.net:443") @@ -138,6 +142,7 @@ def run(typ, freq, data): "message": message, "html": globalVars.config.get("Pushover", "html"), "title": title, + "sound": sound, "priority": priority, "retry": globalVars.config.get("Pushover", "retry"), "expire": globalVars.config.get("Pushover", "expire") diff --git a/plugins/gpiocontrol/gpiocontrol.py b/plugins/gpiocontrol/gpiocontrol.py new file mode 100644 index 00000000..7662fe8c --- /dev/null +++ b/plugins/gpiocontrol/gpiocontrol.py @@ -0,0 +1,118 @@ +#!/usr/bin/python +# -*- coding: UTF-8 -*- + +""" + +@author: KS + +@requires: none +""" + +# Imports + +import RPi.GPIO as GPIO +import time +import threading + +import logging # Global logger +from includes import globalVars # Global variables + +# Helper function, uncomment to use +from includes.helper import timeHandler +from includes.helper import wildcardHandler +from includes.helper import configHandler + +## +# +# onLoad (init) function of plugin +# will be called one time by the pluginLoader on start +# +def onLoad(): + """ + While loading the plugins by pluginLoader.loadPlugins() + this onLoad() routine is called one time for initialize the plugin + + @requires: nothing + + @return: nothing + @exception: Exception if init has an fatal error so that the plugin couldn't work + + """ + global GPIOPIN + global waitTime + + GPIOPIN = globalVars.config.getint("gpiocontrol","pin") + waitTime = globalVars.config.getint("gpiocontrol","triggertime") + + GPIO.setmode(GPIO.BCM) + GPIO.setwarnings(False) + GPIO.setup(GPIOPIN, GPIO.OUT) + + #GPIO schalten beim START + #GPIO.output(GPIOPIN, GPIO.LOW) + #time.sleep(1) + + GPIO.output(GPIOPIN, GPIO.HIGH) + + return + +# +# +# Main function of plugin +# will be called by the alarmHandler +# +def run(typ,freq,data): + """ + @type typ: string (FMS|ZVEI|POC) + @param typ: Typ of the dataset + @type data: map of data (structure see readme.md in plugin folder) + @param data: Contains the parameter for dispatch + @type freq: string + @keyword freq: frequency of the SDR Stick + + @requires: If necessary the configuration hast to be set in the config.ini. + + @return: nothing + @exception: nothing, make sure this function will never thrown an exception + """ + try: + if configHandler.checkConfig("gpiocontrol"): #read and debug the config (let empty if no config used) + + logging.debug(globalVars.config.get("gpiocontrol", "pin")) + logging.debug(globalVars.config.get("gpiocontrol", "triggertime")) + + ########## User Plugin CODE ########## + if typ == "FMS": + th = threading.Thread(target = trigger) + th.start() + #logging.warning("%s not supported", typ) + elif typ == "ZVEI": + th = threading.Thread(target = trigger) + th.start() + #logging.warning("%s not supported", typ) + elif typ == "POC": + if globalVars.config.get("gpiocontrol", "activerics") == "": + th = threading.Thread(target = trigger) + th.start() + else + if data["ric"] in globalVars.config.get("gpiocontrol", "activerics"): + th = threading.Thread(target = trigger) + th.start() + else: + logging.info("Ric not in activerics") + else: + logging.warning("Invalid Typ: %s", typ) + ########## User Plugin CODE ########## + + except: + logging.error("unknown error") + logging.debug("unknown error", exc_info=True) + +def trigger(): + GPIO.output(GPIOPIN, GPIO.LOW) + logging.info("GPIOPIN %s angeschaltet", GPIOPIN) + time.sleep(waitTime) + GPIO.output(GPIOPIN, GPIO.HIGH) + logging.info("GPIOPIN %s ausgeschaltet", GPIOPIN) + + return