# Parameters file for Surveillance Bot
datapath: "/data/SDS/"                    # path to SDS data archive
networks: ["1Y", "HA", "MK"]              # select networks, list or str
stations: "*"                             # select stations, list or str
locations: "*"                            # select locations, list or str
stations_blacklist: ["ATHR", "DOMV", "EREA", "GR19", "GR27", "HAVD", "LAKA", "LFKM", "TEST"]      # exclude these stations
networks_blacklist: []                    # exclude these networks
interval: 60               # Perform checks every x seconds
n_track: 360               # wait n_track * intervals before performing an action (i.e. send mail/end highlight status)
timespan: 7                # Check data of the recent x days
verbosity: 0               # verbosity flag for program console output (not logging)
logging_level: WARN        # set logging level (info, warning, debug)
track_changes: True        # tracks all changes since GUI startup by text highlighting (GUI only)
warn_count: False          # show number of warnings and errors in table
min_sample: 5              # minimum samples for raising Warn/FAIL
dt_thresh: [300, 1800]     # threshold (s) for timing delay colourisation (yellow/red)
html_figures: True         # Create html figure directory and links
reread_parameters: True    # reread parameters file (change parameters on runtime, not for itself/GUI refresh/datapath)

POWBOX:
  pb_ok: 1  # Voltage for PowBox OK
  pb_SOH2: # PowBox channel 2 voltage translations
    -1: {"230V": "PBox under 1V", "12V": "PBox under 1V"}
    1: {"230V": "OK", "12V": "OK"}
    2: {"230V": "OFF", "12V": "OK"}
    3: {"230V": "OK", "12V": "overvoltage"}
    4: {"230V": "OK", "12V": "undervoltage"}
    4.5: {"230V": "OFF", "12V": "overvoltage"}
    5: {"230V": "OFF", "12V": "undervoltage"}
  pb_SOH3: # PowBox channel 3 voltage translations
    -1: {"router": "PBox under 1V", "charger": "PBox under 1V"}
    1: {"router": "OK", "charger": "OK"}
    2: {"router": "OK", "charger": "0 < resets < 3"}
    2.5: {"router": "OK", "charger": "locked"}
    3: {"router": "FAIL", "charger": "OK"}
    4: {"router": "FAIL", "charger": "0 < resets < 3"}
    5: {"router": "FAIL", "charger": "locked"}

# Thresholds for program warnings/voltage classifications
THRESHOLDS:
  pb_thresh: 0.2               # Threshold for PowBox Voltage check +/- (V)
  max_temp: 50                 # max temperature for temperature warning
  critical_temp: 65            # max temperature for critical warning (fail)
  low_volt: 12                 # min voltage for low voltage warning
  high_volt: 14.8              # max voltage for over voltage warning
  unclassified: 5              # min voltage samples not classified for warning
  max_vm_warn: 1.5             # threshold for mass offset (warn), fail)
  max_vm_fail: 2.5             # threshold for mass offset (warn), fail)
  clockquality_warn: 90        # warn level - clock quality ranges from 0 % to 100 % with 100 % being the best level
  clockquality_fail: 70        # fail level
  min_gap: 0.1                 # minimum for gap declaration, should be > 0 [s]


# ---------------------------------- Specification of input channels ---------------------------------------------------
# Currently supported: EX[1-3], VEI, VM[1-3], LCQ
#
# For each channel a factor 'unit' for unit conversion (e.g. to SI) can be provided, as well as a 'name'
# and 'ticks' [ymin, ymax, ystep] for plotting.
# 'warn' and 'fail' plot horizontal lines in corresponding colors (can be str in THRESHOLDS, int/float or iterable)
# keyword "pb_SOH2" or "pb_SOH3" can be used to extract warning values from above POWBOX parameter definition
#
# 'transform' can be provided for plotting to perform arithmetic operations in given order, e.g.:
#  transform: - ["*", 20]
#             - ["-", 20]
#  --> PBox EX1 V to deg C: 20 * x -20
CHANNELS:
  EX1:
    unit: 1e-6
    name: "PowBox Temperature (°C)"
    ticks: [-10, 50, 10]
    transform:
      - ["*", 20]
      - ["-", 20]
    warn: "max_temp"
  EX2:
    unit: 1e-6
    name: "PowBox 230V/12V (V)"
    ticks: [0, 5, 1]
    warn: "pb_SOH2"
  EX3:
    unit: 1e-6
    name: "PowBox Router/Charger (V)"
    ticks: [0, 5, 1]
    warn: "pb_SOH3"
  VEI:
    unit: 1e-3
    name: "Datalogger (V)"
    ticks: [9, 15, 1]
    warn: ["low_volt", "high_volt"]
    fail: 10.5
  VM1:
    unit: 1e-6
    name: "Mass position W (V)"
    ticks: [-2.5, 2.5, 1]
    warn: [-1.5, 1.5]
    fail: [-2.5, 2.5]
  VM2:
    unit: 1e-6
    name: "Mass position V (V)"
    ticks: [-2.5, 2.5, 1]
    warn: [-1.5, 1.5]
    fail: [-2.5, 2.5]
  VM3:
    unit: 1e-6
    name: "Mass position U (V)"
    ticks: [-2.5, 2.5, 1]
    warn: [-1.5, 1.5]
    fail: [-2.5, 2.5]
  LCQ:
    name: "Clock quality (%)"
    ticks: [0, 100, 20]
    warn: "clockquality_warn"
    fail: "clockquality_fail"

# specify data channels (can be additional to the above). From these channels only headers will be read
data_channels: ["HHZ", "HHN", "HHE"]


# ---------------------------------------- OPTIONAL PARAMETERS ---------------------------------------------------------
# deactivate powbox surveillance for stations (e.g. for solar powered), key: station, value: status message (abbr.)
no_pbox_stations: {'GR33': 'SOL', 'GR27B': 'DCN', 'RP01': 'noPBox', 'RP02': 'noPBox', 'RP03': 'noPBox', 'RP04': 'noPBox', 'RP05B': 'noPBox', 'RP06': 'noPBox', 'RP07': 'noPBox', 'RP08': 'noPBox'}

# deactivate mass position surveillance for stations without connected mass channels (e.g. STS-2 instruments), key: station, value: status message (abbr.)
no_mass_stations: {'BIA': 'DCN', 'KNEZ': 'DCN', 'KRUS': 'DCN', 'OHR': 'DCN', 'OTOV': 'DCN', 'SKO': 'DCN', 'STIP': 'DCN', 'VAY': 'DCN', 'ZUPA': 'DCN'}

# add links to html table with specified key as column and value as relative link, interpretable string parameters:
# nw (e.g. 1Y), st (e.g. GR01A), nwst_id (e.g. 1Y.GR01A)
add_links:
  # for example: slmon: {"URL": "path/{nw}_{st}.html", "text": "link"}
  slmon: {"URL": "../slmon/{nw}_{st}.html", "text": "show"}
  24h-plot: {"URL": "../scheli/{nw}/{st}.png", "text": "plot"}
  ppsd: {"URL": "../ppsd/{nw}.{st}.html", "text": "show"}

# add station-independent links below html table (list items separated with -)
add_global_links:
  # for example: - {"text": "our homepage", "URL": "https://www.rub.de"}
  - {"text": "show recent events on map",
     "URL": "https://fdsnws.geophysik.ruhr-uni-bochum.de/map/?lat=39.5&lon=21&zoom=7&baselayer=osm"}

# html logo at page bottom (path relative to html directory)
html_logo: "logo.png"

# E-mail notifications
EMAIL:
  # specify mail server and credentials
  # port, auth_type, user and password are only required if mailserver is not set to "localhost"
  # user and password can be set to "ENV" or "DOCKER" to read from environment variables or docker secrets
  mailserver: "smtp.example.org"      # mail server
  auth_type: "SSL"                    # mail authentication type, can be "SSL", "TLS" or "None"
  port: 465                           # mail port, default 465 for SSL, 587 for TLS
  user: "DOCKER"                      # mail user, read from environment variable if set to "ENV" or from docker secret if set to "DOCKER"
  password: "DOCKER"                  # mail password, read from environment variable if set to "ENV" or from docker secret if set to "DOCKER"
  # specify mail recipients, sender and blacklists
  addresses: ["test@example.org"]  # list of mail addresses for info mails
  sender: "<test@example.org>"              # mail sender
  stations_blacklist: []                                          # do not send emails for specific stations
  networks_blacklist: []                                          # do not send emails for specific network
  # specify recipients for single stations in a yaml: key = email-address, val = station list (e.g. [1Y.GR01, 1Y.GR02])
  external_mail_list: "conf/mailing_list.yaml"