Digital Loggers



Only the WiFi capable, Atheros-based power controllers support the REST API.

Download the RestAPI reference here.

These examples are using cURL. Not all curl versions authenticate properly, such as the version that comes with Windows.
This version of curl is tested and works well.


To use the REST API, enable the "Allow REST-style API" on the External APIs page of the power controller


REST API Power Switch Control Examples


Look at the API - level 1
curl -u admin:1234 -H "Range: dli-depth=1" -H "Accept: application/json" --digest "http://192.168.0.100/restapi/"

Outlet/relay control examples. Relays are zero based (0-7).

Switch relay 3 on. (true=on   false=off)
curl -X PUT -H "X-CSRF: x" --data "value=true" --digest "admin:1234@http://192.168.0.100/restapi/relay/outlets/2/state/" .


Turn all relays on.
curl -u admin:1234 -X PUT -H "X-CSRF: x" --data "value=true" --digest "http://192.168.0.100/restapi/relay/outlets/all;/state/"


Turn relays 1 and 5 on.
curl -u admin:1234 -X PUT -H "X-CSRF: x" --data "value=true" --digest "http://192.168.0.100/restapi/relay/outlets/=0,4/state/"


Get the status of relay/outlet 1
curl -k -u admin:1234 -H "Accept:application/json" --digest https://192.168.0.100/restapi/relay/outlets/2/state/


Get the status of all relays
curl -k -u admin:1234 -H "Accept:application/json" --digest https://192.168.0.100/restapi/relay/outlets/all;/state/


Running scripts

Run a script (flash_a_light)
curl -u admin:1234 --digest -H "X-CSRF: x" -H "Accept: application/json"  --data "[{\"user_function\":\"flash_a_light\"}]" http://192.168.0.100/restapi/script/start/


Run a script passing arguments (cycle_an_outlet(outlet number, interval)) and HTTPS
curl -k -u admin:4321 -H "X-CSRF: x" -H "Content-Type: application/json" --digest --data-binary "[{\"user_function\":\"cycle_an_outlet\",\"source\":\"cycle_an_outlet(5,10)\"}]" "https://192.168.0.100/restapi/script/start/"


Show the running threads (scripts)
curl -u admin:1234 -X GET -H "Accept: application/json" --digest http://192.168.0.100/restapi/script/threads/


Stop a running thread (by Thread ID)
-u admin:1234 --digest -H "X-CSRF: x" -H "Accept: application/json" -H "Content-Type: application/json" --data "[\"20\"]" http://192.168.0.100/restapi/script/stop/


Stop all running threads (scripts)
curl -u admin:1234 --digest -H "X-CSRF: x" -H "Content-Type: application/json" --data "[\"all\"]" http://192.168.0.100/restapi/script/stop/


Getting info from meters (when equipped). Buses and sensors are zero indexed.

Get the EPCR Bus 2 Voltage (zero indexed)
curl -u admin:1234 -H "Accept:application/json" http://192.168.0.100/restapi/meter/values/buses.1.voltage/value/


Get the EPCR Bus 1 (zero indexed) Current. This will be a small number if zero (e.g. 1.4e-45), so you'll need to round it.
curl -u admin:1234 -H "Accept:application/json" http://192.168.0.100/restapi/meter/values/buses.0.current/value/


Get the EPCR Bus 1 Total Energy Useage in Joules. (1 kWh = Joules * 0.00000027778)
curl -u admin:1234 -H "Accept:application/json" http://192.168.0.100/restapi/meter/values/buses.0.total_energy/value/


EPCR internal temperature (degrees kelvin)   Celsius=kelvin - 273.16   Farenheight=9 / 5 * (kelvin - 273.16) + 32
curl -u admin:1234 -H "Accept:application/json" http://192.168.0.100/restapi/meter/values/environment.temperature/value/


EPCR/DIN4 sensor temperature (degrees kelvin)
curl -u admin:1234 -H "Accept:application/json" http://192.168.0.100/restapi/meter/values/sensors.0.temperature/value/

EPCR/DIN4 sensor humidity
curl -u admin:1234 -H "Accept:application/json" http://192.168.0.100/restapi/meter/values/sensors.0.relative_humidity/value/




Have a smart way to use your power switch?  We'll acknowledge your contribution. Learn more about scripting here or AutoPing here.