-
Notifications
You must be signed in to change notification settings - Fork 24
Configuration
To properly run the smartmeter-datacollector
a .ini
configuration file is required. This file can either be written manually or generated with the smartmeter-datacollector-configurator
web interface.
Please refer to smartmeter-datacollector-configurator for further information.
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:
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).
- On Linux this is usually a
-
key
: (optional) If the data pushed from the smart meter is encrypted thesmartmeter-datacollector
needs to decrypt the messages first. With this option a key in the form of000102030405060708090A0B0C0D0E0F
can be applied. If this setting is not definedsmartmeter-datacollector
assumes that the received data is unencrypted.
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:
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 (heremqtt
). -
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.
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 (herelogger
). -
name
: Name of the logger instance used to print measurements.
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
[reader0]
# type of the connected smart meter
type = lge450
# serial port to which the smart meter is connected
port = /dev/ttyUSB0
# optional encryption key
key =
[sink0]
# type of the sink
type = mqtt
# host / IP address of the MQTT broker
host = localhost
# port of the MQTT broker
port = 1883
# whether to use TLS (Transport Layer Security)
tls = False
# optional path to the CA certificate used to validate the MQTT broker's certificate
ca_file_path =
# whether to check the hostname of the MQTT broker against the certificate
check_hostname = False
# optional username for authentication with the MQTT broker
username =
# optional password for authentication with the MQTT broker
password =
# optional path to the client certificate for authentication with the MQTT broker
client_cert_path =
# optional path to the private key for the client certificate for authentication with the MQTT broker
client_key_path =
[sink1]
# type of the sink
type = logger
# name of the logger
name = DataLogger
[logging]
# log level configuration: DEBUG / INFO / WARNING / ERROR
default = WARNING
smartmeter = WARNING
collector = WARNING
sink = WARNING
Smart Meter Data Collector