eGauge Meter API
eGauge Meter API
The eGauge WebAPI is a JSON-based API that provides access to eGauge meters. It offers secure means to read device data, configure the device, and perform various control operations.
The WebAPI is intended to eventually replace the eGauge XML API. For new applications, developers are encouraged to use WebAPI rather than the legacy XML API.
The authentication service. Clients can use this to obtain and manage tokens that grant access to the other resources in this API.
The meter uses JSON Web Tokens (JWT or simply token) to restrict access to protected resources. Clients must include such tokens in requests via the HTTP Authorization header. This header must have the form:
Authorization: Bearer JWT
where JWT is a valid token.
Tokens are valid for a limited time; typically for about 10 minutes. However, a meter may revoke a token earlier, e.g., due to a reboot.
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).
An eScript expression that returns the value to use on the left hand side of the comparison.
The comparison-operator to use for comparing the left-hand-side expression lhs
against the right-hand side expression rhs
. It may be one of:
<
: Condition is true if lhs
is less than rhs
.<=
: Condition is true if lhs
is less-than-or-equal to rhs
.=
: Condition is true if lhs
is equal to rhs
.!=
: Condition is true if lhs
differs from rhs
.>=
: Condition is true if lhs
is greater-than-or-equal to rhs
.>
: Condition is true if lhs
is greater than rhs
.An eScript expression that returns the value that to use on the right hand side of the comparison.
Alert detail message. This may be up to 255 bytes in length. The following sequences within this string get replaced as follows:
%%
is replaced by a single percent character.%l
is replaced by the value of the lhs
expression.%r
is replaced by the value of the rhs
expression.%L
is replaced by the lhs
expression string.%R
is replaced by the rhs
expression string.The frequency with which this custom alert should be checked. Possible values are:
sec
: The alert will be checked once a second.min
: The alert will be checked once a minute.hr
: The alert will be checked once an hour.dy
: The alert will be checked once a day.wk
: The alert will be checked once a week.mon
: The alert will be checked once a month.an
: The alert will be checked once a year.The configuration for reporting alerts via email server. If alert reporting via web server is enabled (/config/alert/reporter/web/uri is not empty), reporting via email server is disabled.
The hostname of a mail server that speaks the SMTP protocol. If this is set to an empty string, the meter will attempt to deliver mail directly to the destination host. Many Internet service providers block direct mail delivery, so leaving this string empty generally results in alert emails getting blocked.
The options to use when sending an alert report to the web server.
This resource is available only if /config/alert/reporter/web/service is an empty string.
Multiple options can be specified in the string by separating them with a comma. Supported options are:
deflate
: Use HTTP Content-Encoding deflate
when transmitting the alert report.
gzip
: Use HTTP Content-Encoding gzip
when transmitting the alert report.
secure
: Only send the alert report if the server's HTTP certificate can be verified by the meter. This option is ignored if /config/net/http/client/insecure is true
.
The name of the alert service provider to use for reporting alerts.
To set this to a non-empty value please use the service activation command since that ensures the service provider knows to expect alerts from this meter. The body of the activation request should contain member service
set to the string alert
and provider
set to name of the desired service provider.
The URI of the web server to use for reporting alerts.
This resource is available only if /config/alert/reporter/web/service is an empty string.
The user name to provide to the web server for authentication purposes. If this string is not empty, the user name and the password are both sent to the web server using HTTP Basic authorization. For security reasons, this should only be used when connecting to the server via an encrypted connection (https).
This resource is available only if /config/alert/reporter/web/service is an empty string.
The priority of each system-generated alert. /sys/alert provides a description of these alerts.
The BACnet configuration.
The BACnet server configuration.
The IPv4 port number used by the server when bip
is enabled in /config/bacnet/server/enable. The default value is 0xBAC0 (47808).
If true, the BACnet server reports cumulative values relative to the meter epoch. If false, raw absolute values are reported relative to when the meter was manufactured.
The BACnet over MS/TP configuration. This is used only if the mstp
protocol is enabled.
The serial-port to use for the MS/TP protocol.
The time when the meter started recording data. This is a decimal Unix timestamp string.
The relevance of this resource is that other services in this API by default return accumulated register values relative to this time so that, at the time of the epoch, they all read 0. Changing this value therefore changes the values reported by those services. Similarly, user interfaces that use this API generally do not present data before the epoch, effectively providing a limit to the history visible to the user.
Writing this resource does not change the data stored in the database. In other words, the epoch generally can freely be moved forward or backward in time. The only constraint is that the new epoch does have to be within the time range covered by the database. If a future time is specified, it will automatically be capped to the time of the most recent row in the database. If a time is specified that is older than the oldest row in the database, an error object is returned. If this error occurs, check the device time (/sys/time) and database configuration (/sys/db) to confirm that they have the expected values.
The fontset to use for the display. Possible values are:
small
: Smaller than the normal
fontset, this is a lower quality fontset that can fit more text on the display.
normal
: This fontset provides a good tradeoff between font quality and the amount of text that can fit on the display. This should work well for languages with relatively simple characters, such as English or French.
large
: This fontset should work well for languages with more complex characters such as Korean or Chinese.
Note The value of this resource needs to be localized (translated) before presenting it to a user.
The angle in degrees by which the orientation of the display should be rotated in the counterclockwise direction. An angle of 0 degree results in the display being aligned with the label on the meter. The value of this resource is rounded to an integer multiple of 90 degrees.
Specifies how the named register is to be displayed. The following characters may appear in this string:
i
: The instantaneous (rate of change) value of the register should be displayed.
c
: The accumulated (cumulative) value of the register should be displayed.
Note that an empty string imples that the register is not displayed at all
For the special keyword .default
, this establishes how registers should be displayed that are not mentioned otherwise.
The code of the preferred language for the meter. When the meter needs to generate a message (e.g., as a result of an alert triggering), it will generate the message in the language selected by this code whenever possible. The code should be in a format acceptable to the setlocale()
function. Language codes currently supported include:
de
: German.
en
: US English (defaults to 12-hour clock and imperial units).
en_GB
: British English (defaults to 24-hour clock and metric units).
es
: Spanish.
fr
: French.
he
: Hebrew.
it
: Italian.
ko
: Korean.
pl
: Polish.
zh_Hans
: Simplified Chinese (Mandarin).
zh_Hant
: Traditional Chinese (Cantonese).
See eGauge Internationalization Instructions for information on adding other languages or improving an existing translation.
Note When accessing the meter from a web browser, the value of this resource has normally no effect as the user interface is presented in the language selected by the browser.