/cmd

The service provides the ability to execute various operations for their side effects, such as rebooting the meter. Unless stated otherwise, the resources in this service are available only to users with the save right (see /auth/rights).

Clear data

Clear data. The string in the request body identifies what data to clear:

  • excess: For register values that are read from a remote device, it is possible that the meter may not be able to reach the remote device at times (e.g., due to a networking problem). If the remote device provides cumulative values, this means that when the remote device becomes accessible again, the cumulative value may have increased significantly, which could then cause a spike in the graphed values for that register. To prevent such spikes, the meter will instead record the jump as an excess and then replay that excess gradually over time so that the meter can catch up to the true value without causing a spike. Executing this command clears to zero the excess of all registers. This will typically cause a spike in the graphed values for any remote registers which had a non-zero excess but, on the positive side, will then ensure that the cumulative values afterwards match those of the remote device(s).

    Note If excess keeps accumulating, it may be better to use the spiky option for remote registers.

  • web_cache: Clears the web server cache of compressed files. Under normal circumstances, it is not necessary to clear this cache explicitly. However, this command can be used in case the cache gets corrupted, e.g., due to a power cycle while the meter is in the middle of writing a cache file.

SecurityApiKey
Request
Request Body schema: application/json
string
Enum: "excess" "web_cache"
Responses
200

Clear response.

401

Unauthorized response.

post/cmd/clear
Request samples
application/json
"excess"
Response samples
application/json
{
  • "status": "OK",
  • "error": "Error message (present if an error occurred)."
}

Manipulate database

This command supports restoring the database from a backup file, zeroing of all or parts of the database, as well as splitting the positive values of certain registers into separate positive-only registers.

SecurityApiKey
Request
Request Body schema: application/json
action
required
string

The action to perform. The possible values are:

  • restore: Restores data from a backup file to the device database.
  • zero: Zeroes out one or more registers in the device database.
  • split: Split the positive changes of a net register into a separate positive-only register.
Enum: "restore" "zero" "split"
from
string (ForeverStamp)

If specified, this limits the operation to data that is not older than the timestamp specified here.

to
string (ForeverStamp)

If specified, this limits the operation to data that is not younger than the timestamp specified here.

regs
Array of integers

If specified, the operation is limited to the registers whose database ids appear in this list.

data
string

This member is required for action restore. It contains the binary backup data to be restored, encoded in base64. A device may reject a restore request if this member is larger than 2 MiB. It may therefore be necessary to split up a large backup file into multiple smaller chunks that are then restored one after the other.

more_chunks
boolean

This is used only for restore operations. It indicates whether a the backup data has been split up into multiple chunks and the current chunk is to be follow by the next older, adjacent chunk. Setting this flag is not required, but doing so can greatly speed up a restore operation. On the other hand, setting this flag to true without following it up with the next older adjacent chunk can leave the database in a corrupted state, with large spikes at the beginning of the current chunk.

Responses
200

DB response.

401

Unauthorized response.

post/cmd/db
Request samples
application/json
{
  • "action": "restore"
}
Response samples
application/json
{
  • "status": "OK",
  • "error": "Error message (present if an error occurred)."
}

Restore factory settings.

Restore the factory settings and reboot the meter.

Warning All existing data and settings will be lost.

SecurityApiKey
Responses
200

Restore factory settings response.

401

Unauthorized response.

post/cmd/factory-restore
Request samples
Response samples
application/json
{
  • "status": "OK",
  • "error": "Error message (present if an error occurred)."
}

Reboot the meter.

Initiate a reboot of the meter. The actual reboot command is delayed by one second to increase the likelihood that the reply to this request can be received by the client before the meter shuts down.

Once initiated, the meter will be unavailable for a while (typically, 20 to 60 seconds). If the network configuration of the meter was changed, the reboot may cause the meter to not become available again at the old network address. Thus, the client should check for such changes before initiating the reboot and take appropriate action if the network configuration did change.

SecurityApiKey
Responses
200

Set time response.

401

Unauthorized response.

post/cmd/reboot
Request samples
Response samples
application/json
{
  • "status": "OK",
  • "error": "Error message (present if an error occurred)."
}

Set date and time.

Optionally set the date/time of the meter and restart the NTP and/or the PTP services, if configured.

SecurityApiKey
Request
Request Body schema: application/json
One of:

A Unix timestamp expressed as a decimal string that may contain a fractional value for sub-second resolution. A string is used here since most JSON libraries store numbers as IEEE-754 double-precision numbers and the 54-bit mantissa of that format may not be sufficient to accurately represent the timestamp.

string (ForeverStamp)
Responses
200

Set time response.

401

Unauthorized response.

post/cmd/set-time
Request samples
application/json
"1677523091.000900435"
Response samples
application/json
{
  • "status": "OK",
  • "error": "Error message (present if an error occurred)."
}

Update the meter.

Update the meter firmware or kernel.

SecurityApiKey
Request
Request Body schema: application/json
action
required
string

The action to perform. The value list requests that the latest available version should be returned as a version object response. The value install requests that the kernel or firmware should be updated and a token object response should be returned.

Enum: "list" "install"
target
required
string

The target of the action. A value of fw indicates that the meter firmware is the target of the action, a value of kernel indicates that the kernel is the target.

Enum: "fw" "kernel"
branch
string

The release branch to install from or to list the available version for. If left unspecified, this defaults to the branch the currently running firmware was installed from. An empty string refers to the default release branch.

force
boolean

If true, the firmware/kernel is installed even if the version to be installed does not appear to be newer than the currently installed version.

version
string

The version to install.

Note Downgrading to an older firmware or kernel may have unpredictable effects and may damage the meter.

Responses
200

Update response.

401

Unauthorized response.

post/cmd/update
Request samples
application/json
{
  • "action": "list",
  • "target": "fw"
}
Response samples
application/json
{
  • "version": 4.4,
  • "minimum": "4.1.2",
  • "error": "Error message (present if an error occurred)."
}

Manage WLAN (WiFi) connection.

Manage WLAN (Wi-Fi) connection. See /sys/net/wlan to get the currently detected and configured WLAN networks.

SecurityApiKey
Request
Request Body schema: application/json
action
required
string

The action to perform. It must be one of:

  • add: Add a WLAN network by specifying its SSID, whether or not it is a hidden network, and, optionally, its passphrase or passkey. If adding the network succeeds, it is also selected as the currently active one.
  • select: Select a network as the currently active one.
  • forget: Forget the information associated with a network.
Enum: "add" "select" "forget"
hex
boolean

Must be set to true if member key is a hexadecimal key rather than a passphrase.

hidden
boolean

Must be set to true if the network to be added is hidden (i.e., its SSID is not being broadcast).

id
integer >= 0

The id of the network that should be selected or forgotten.

key
string

The passphrase or hex key to use for the network being added. If omitted, the newly added network has key management disabled.

ssid
string

The name (SSID) of the network to be added. The characters in this string may be any Unicode character except for ASCII newline or ASCII NUL.

Responses
200

WLAN response.

401

Unauthorized response.

post/cmd/wlan
Request samples
application/json
{
  • "action": "add"
}
Response samples
application/json
{
  • "status": "OK",
  • "error": "Error message (present if an error occurred)."
}