Setting up the configuration

In order to use a logger, the config.txt file must be present and configured properly. If the application is missing settings or settings are not correct, the application shall not run properly and report warnings in the system log.

YAML markup language

A config file is according to the YAML markup language. Non-valid yaml markup can not be decoded which makes the application unable to run.

Cronjob interval

Scheduled tasks are tasks that are executed at a predefined interval with the function scheduler.add_task(). This interval can be configured in the similar way as cronjobs are configured. A interval description is built up out of 5 fields separated by white spaces that represent a set of times at which to execute the task The function runs when the current date matches the interval description. A interval description looks like this:

# ┌───────────── second (0 - 59)
# │ ┌───────────── minute (0 - 59)
# │ │ ┌───────────── hour (0 - 23)
# │ │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ │ ┌───────────── day of the week (1 - 7) (Monday to Sunday)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *

Configuration structure

Each driver settting starts with the name of the driver followed by a ‘:’.
Placing a hashtag (#) in front of it will disable it (actually any character will, but for the readablity and consistency we strongly advise to use the ‘#’).
If don’t use a driver, best practise is remove it completely from the config.txt file, so you only have the drivers you actually use in it.
This will make your config easier to read.

The id name is free to choose, we do advise to stick to the defaults when using OMC-DOL.

Example

The following example shows a valid config.txt file

# ----System---- #
Omc048:
  system_id: Scrilo
  application: Generic_logger
  file_log_level: info
  repl_log_level: info
  utc_time_offset_hours: +1
  utc_time_offset_minutes: +0

Usb_wake:
- id: usb_control
  wake_interval: "0,10,20,30,40,50 * * * *"

# ----Modem-Settings---- #
Modem:
  id: onboard_modem
  port: modem
  sim_username: KPN
  sim_password: gprs
  apn: internet

# ----FTP-Settings---- #
Ftp:
- id: data_ftp
  url: ftp.ftpserver-name.com
  port: 21
  username: user
  password: pass
  transmit_interval: "30 0,5,10,15,20,25,30,35,40,45,50,55 * * *"

# ----Sensor-Settings---- #
Gps:
- id: gps0
  port: nmea
  baudrate: 4800
  rxbuf: 1024
  sample_interval: "0 * * * *"
  supply_port: 3
  supply_port_always_on: False
  timeout: 120
  utc_time_sync: True

EXO2:
- id: EXO2_0
  port: serial1
  sample_interval: "0 * * * *"
  supply_port: 1
  supply_port_always_on: False
  timeout: 10
  samples_per_wipe: 10

NEP5000:
- id: NEP0
  port: serial2
  mode: RS485
  sample_interval: "0 * * * *"
  supply_port: 2
  supply_port_always_on: False

Onboard:
- id: board_sensors0
  sample_interval: "0 * * * *"

Analog_voltage:
- id: analog_voltage1
  port: 1
  sample_interval: "0,10,20,30,40,50 * * * *"
  min_in: 0
  max_in: 24
  min_out: 0
  max_out: 24
  log_name: Voltage1
  log_unit: V
  log_tag: VOLT1

Analog_current:
- id: analog_current1
  port: 1
  sample_interval: "0,10,20,30,40,50 * * * *"
  min_in: 0
  max_in: 24
  min_out: 0
  max_out: 100
  log_name: Current1
  log_unit: %
  log_tag: CURR1

# ----Data-log-settings---- #
Data_file:
- id: data
  create_interval: "0 0,5,10,15,20,25,30,35,40,45,50,55 * * *"

Log_parameters:
  gps0:
  - Latitude
  - Longitude
  - Course true
  - Course magnetic
  - Satellites