1. Command line
  2. Configuration files
    1. Meter configuration

Currently, no user-friendly graphical user interface is provided for configuration. The application can be configured in two ways: 1) command line parameters, and 2) configuration file.

Command line

The command line parameters are documented in the following table:

Option Description
--info Enable info mode. No measurements will be performed. Information about detected meters will be listed and a configuration file will be generated.
--debug Enable debug output. Debug messages will be printed to the log (console).
--verbose Enable verbose debug output. Debug messages will be printed to the log (console).
--mqtt Launch the MQTT client. Assumes that a MQTT server is available in the local network. See the configuration files for MQTT configuration.
--telnet Launch a TCP telnet server. This server receives commands with even lower overhead than the HTTP server.
--nohttp Disable the HTTP server. The HTTP server provides both a Web UI and get/post endpoints for receiving e.g. trigger commands and collectd dumps.
--nodrivers Disable the native drivers.
--simu Enable simulated meters. This option is useful for experimenting with the software. See the configuration file for configuring the simulated meters.
--headless In the headless mode, no keyboard input will be monitored.
--cors Enables the 'Access-Control-Allow-Origin' header, which makes it possible to submit resource data from Selenium JS sessions.

By default, the application starts in interactive mode and with the HTTP server enabled. To close the application, simply press Enter or ctrl-c. In the headless mode, no keyboard input will be monitored, and a kill signal needs to be sent to close the application.


Configuration files

On Linux, the global configuration has a well-defined XDG location, namely ~/.config/powergoblin/default.json. This file is basically a serialized version of the GlobalConfiguration structure defined in the source code file.

The options are documented in the following tables

Option Description
Flags (global)
logMeterEvents Maintain per-meter state data (default=y)
implicitSession Implicitly start a session with all available meters (default=y)
allowOriginHeader Configures 'Access-Control-Allow-Origin: *' in web API requests
modeInfo Show only information about the meters, then quit
modeDebug Enable debug mode
modeVerbose Enable verbose debug mode
modeInteractive Interactive mode (exit with 'Enter') (default=y)
enableHotplug Periodically scan for new devices (default=y)
enableMqtt Enable MQTT client
enableHttp Enable HTTP server (default=y)
enableTelnet Enable Telnet server
enableSimulatedMeters Enable simulated meters (for testing)
enableLogs Enable reading/writing of logs (default=y)
enableDrivers Enable native drivers (default=y)

Option Description
Plots (global)
dockerImage Docker image to use when generating plots
enableDocker Use docker / native tools
renderingTimeOut Generation timeout (rendering)

Option Description
Global
flags Nested flags configuration
session Nested session configuration
plot Nested plot configuration
name Name of the PowerGoblin instance
statusPeriod Timer period for status messages & device scan
logPath Path to log files (relative to the application root)
httpContentPath Path to HTTP content (relative to the application root)
httpPort Port for HTTP access (default: 8080)
telnetPort Port for telnet access (default: 9000)
mqttHost MQTT server host name
mqttPort Port for MQTT access (default: 1883)
mqttTopicPrefix Prefix for MQTT topics
simulatedCount How many simulated meters to generate

Option Description
Session
name Session name (default: default)
author Author name (default: user)
description Session description
resourceFilters List of collectd resource columns to include
autoSave Automatically save the session when closing
summarizeRun0 Implicit run 0 is included in the summaries in case there are also explicit runs
writeDumps Write the various data dumps in the log directory
writeReport Write a report file when saving the session
writeSpreadsheet Write a spreadsheet file when saving the session
writePlotScripts Write plot scripts when saving the session
writePlots Write plots when saving the session

Meter configuration

When launching the application, for each detected SmartPower 3 meter, a configuration file such as powergoblin-SP3-3a08929c0deaea11a5a061e7994a5d01.json will be created on the launch directory. SP3 here refers to the type of meter and 3a08929c0deaea11a5a061e7994a5d01 to its serial number (either extracted from the meter's ROM or a virtual serial number generated from the device parameters).

The default configuration for SP3 looks like this:

{
  "pollPeriod" : 10,
  "sampleRate" : 100,
  "portConfiguration" : {
    "baudRate" : "B115200",
    "dataBits" : "DataBits8",
    "stopBits" : "StopBits1",
    "parity" : "None",
    "flowControl" : "None"
  }
}

The whole configuration will be rejected if any of the parameters is considered invalid. The data model of these configuration files may change so the files may need to be regenerated at some point.