Skip to content

How to Use

Mario Coray edited this page Sep 14, 2021 · 4 revisions

The usage of smartmeter-datacollector depends on the installation method. Independent of the installation method is a .ini configuration file which is required to properly run the application.

Configuration

See Configuration for information and instructions about configuring smartmeter-datacollector.

Usage of Demo

Go to Demo (Raspberry Pi Image) to find instructions on how to set up a Raspberry Pi with a custom image that has all software preinstalled which is necessary to retrieve and display measurements of a smart meter.

Smart Meter Data Collector Application

Run manually

You can manually run smartmeter-datacollector with the following command:

smartmeter-datacollector --config datacollector.ini

Ensure that no other instance of the software is currently running, neither manually started nor as a service.

The following command line arguments are supported:

  • -h, --help: Shows the help output of smartmeter-datacollector.
  • -c, --config CONFIG: Path to the .ini configuration file.
  • -s,--saveconfig: Create a default .ini configuration file.
  • -d, --dev: Enable development mode.

Configuration

The configuration file can be located anywhere on the file system and can have any filename. If no .ini configuration file is specified a default configuration with the following options is used:

  • Landys+Gir E450 smart meter in unencrypted mode connected to /dev/ttyUSB0
  • LOGGER sink
  • MQTT sink connected to a local broker without encryption or authentication

Run as a systemd service

When smartmeter-datacollector has been installed as a Debian package (python3-smartmeter-datacollector) it provides a systemd .service file named python3-smartmeter-datacollector.service. Therefore the service can be managed using the systemctl command:

sudo systemctl start|stop|restart python3-smartmeter-datacollector

Enabling or disabling the service can also be managed using the systemctl command:

sudo systemctl enable|disable python3-smartmeter-datacollector

Inspecting the log messages can be done using the journalctl command:

journalctl -u python3-smartmeter-datacollector [-f]

Configuration

The systemd service expects the .ini configuration to be located at /var/lib/smartmeter-datacollector/datacollector.ini. This is also the default location used by the smartmeter-datacollector-configurator web interface to load and save the managed configuration.

Smart Meter Data Collector Configurator Application

Run manually

You can manually run smartmeter-datacollector-configurator with the following command:

smartmeter-datacollector-configurator [-c <config_path>] [-s <static_path>]

Ensure that no other instance of the software is currently running, neither manually started nor as a service.

The following command line arguments are supported:

  • -h, --help: Shows the help output of smartmeter-datacollector-configurator.
  • -c, --config PATH: Directory path where the configuration files are read and deployed (default: Current directory ./).
  • -s,--static PATH: Directory path where the static frontend files are located. If left empty the app check if a static directory exists in the package location and falls back to the current directory ./static.
  • --host: Listening host IP (default: 127.0.0.1).
  • --port: Listening port number (default: 8000).
  • -d, --dev: Enable development mode which provides debug logging and hot reloading.

Run as a systemd service

When smartmeter-datacollector-configurator has been installed as a Debian package (python3-smartmeter-datacollector-configurator) it provides a systemd .service file named python3-smartmeter-datacollector-configurator.service. Therefore the service can be managed using the systemctl command:

sudo systemctl start|stop|restart python3-smartmeter-datacollector-configurator

which runs the application with the following arguments:

  • --host 0.0.0.0
  • --port 8000
  • -c /var/lib/smartmeter-datacollector

Enabling or disabling the service can also be managed using the systemctl command:

sudo systemctl enable|disable python3-smartmeter-datacollector-configurator

Inspecting the log messages can be done using the journalctl command:

journalctl -u python3-smartmeter-datacollector-configurator [-f]