Skip to content

Configuration

Sascha Montellese edited this page Sep 13, 2021 · 5 revisions

To properly run the smartmeter-datacollector a .ini configuration file is required. This file can either be written manually or generated with the Smart Meter Data Collector Configurator web interface.

Using Smart Meter Data Collector Configurator

Please refer to smartmeter-datacollector-configurator for further information.

Manually write configuration

The .ini configuration file consists of multiple sections declared with [<section name>]. Each section holds certain settings of the form <settings name> = <value>. If an optional setting shall not be set either do not set a value on the right side of = or do not list the setting in the section at all.

smartmeter-datacollector uses the following sections and settings:

Smart Meter Section

Each smart meter is defined with a separate [readerX] section. X can be a number or string, however a smart meter section must start with reader and each section name must be unique throughout the whole configuration.

The default configuration for a smart meter is:

[reader0]
type = lge450
port = /dev/ttyUSB0
key = 
  • type: Type of the connected smart meter.
    Possible values are:
    • lge450: L+G E450
  • port: Serial port to which the smart meter is connected.
    • On Linux this is usually a /dev/ttyUSB* device file.
    • On Windows this is a COM* port (the software has never been tested on Windows).
  • key: (optional) If the data pushed from the smart meter is encrypted the smartmeter-datacollector needs to decrypt the messages first. With this option a key in the form of 000102030405060708090A0B0C0D0E0F can be applied. If this setting is not defined smartmeter-datacollector assumes that the received data is unencrypted.

Data Sink Section

Inside smartmeter-datacollector the measurements received from one or more smart meters are passed to data sinks which define how and where the data is forwarded to. Each sink is declared in one section of the form [sinkX] where X can be a number or string, however a data sink section must start with sink and each section name must be unique throughout the whole configuration.

The following types of sinks exist at the moment:

MQTT Sink

All measurements are sent to an MQTT broker (server). An MQTT topic is in the form of smartmeter/<smart meter ID>/<data point type>. The easiest way to get the topic names is to subscribe to the MQTT broker and receive updates to all topics.

The default configuration for a MQTT sink is:

[sink0]
type = mqtt
host = localhost
port = 1883
tls = False
ca_file_path = 
check_hostname = False
username = 
password = 
client_cert_path = 
client_key_path = 
  • type: Type of the sink (here mqtt).
  • host: Host / IP address of the MQTT broker.
  • port: Port number of the MQTT broker.
  • tls: Whether to use TLS (Transport Layer Security). The following settings are only used if TLS is enabled.
    • ca_file_path: (optional) Path to the CA certificate used to validate the MQTT broker's certificate.
    • check_hostname: Whether to check the hostname of the MQTT broker against the certificate.
    • client_cert_path: (optional) Path to the client certificate for authentication at the MQTT broker.
    • client_key_path: (optional) Path to the private key for the client certificate for authentication at the MQTT broker.
  • username: (optional) Username for authentication at the MQTT broker.
  • password: (optional) Password for authentication at the MQTT broker.

Logger Sink

All measurements are printed to the console. If smartmeter-datacollector is run as a systemd service the log is written to the system journal (systemd-journald).

The default configuration for a Logger sink is:

[sink1]
# type of the sink
type = logger
# name of the logger
name = DataLogger
  • type: Type of the sink (here logger).
  • name: Name of the logger instance used to print measurements.

Logging Settings

This section, named [logging], allows you to set the log levels of the different modules of the software. All entries are optional.

[logging]
# log level configuration: 
default = WARNING
smartmeter = WARNING
collector = WARNING
sink = WARNING

The possible settings / modules are:

  • default: General log level in software (i.e. root logger)
  • smartmeter: Smart meter and utilities
  • collector: Bridge between smart meters and data sinks.
  • sink: Data sinks

The possible values (i.e. log levels) are:

  • DEBUG
  • INFO
  • WARNING
  • ERROR
  • FATAL
Clone this wiki locally