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.
curl -i -X GET \ https://webapi.egauge.net/_mock/webapi/4.6/openapi/config/display/backlight/duration \ -H 'Authorization: Bearer <YOUR_JWT_HERE>'