Digital Loggers


 


Using cURL to control your switch.


 

 

Compatible Devices

This page applies to our non-WiFi products like the 220V Power Controller, the DIN Relay III, DC Power Switch, and the Web Power Switch 7.   These products also contain a BASIC scripting language.

 

For scripting a WiFi enabled product like the Ethernet Power Controller 5 consider Lua.

 

What's cURL?

cURL is a library for transmitting data via URL syntax.  It supports HTTP/S, so it's a handy tool for working with your power switch. cURL is free and open-source. Start by downloading it here.

 

Which HTTP Commands Can I cURL?

Every command supported by the switch.   The basic HTTP syntax is explained here.   Just use "view source" on any browser to reveal the rest.

 

Examples?

Turn on outlet 1:
curl http://admin:4321@lpc.digital-loggers.com:80/outlet?1=ON
Power off outlet 1:
curl http://admin:4321@lpc.digital-loggers.com:80/outlet?1=OFF
Cycle outlet 1:
curl http://admin:4321@lpc.digital-loggers.com/outlet?1=CCL
Run a script starting at line 10:
curl http://admin:4321@lpc.digital-loggers.com/script?run010
Get the encoded outlet status:
curl http://admin:4321@lpc.digital-loggers.com/status


This sample setup script does pretty much everything...  To execute it:   curl -K sample.curl

#!/usr/bin/curl -K
#
silent
retry=3
show-error
basic
max-time=10
#
######################################################################
# Unit Names:
#
#several names in one line
url="http://admin:4321@epcr.digital-loggers.com/unitnames.cgi?ctrlname=try+%5Bme%5D+please&outname1=Outlet+1+label&outname7=Outlet+7+label"
#or just one
url="http://admin:4321@epcr.digital-loggers.com/unitnames.cgi?outname8=Outlet+8+label"
#or all in one
url="http://admin:4321@epcr.digital-loggers.com/unitnames.cgi?outname[2-6]=unused"

######################################################################
# Scripting:
#
# disable scripting
url="http://admin:4321@epcr.digital-loggers.com/script.cgi?robdelay=1"
# clear range
url="http://admin:4321@epcr.digital-loggers.com/script?edit[008-029]=NOP"
# edit several lines at once
url="http://admin:4321@epcr.digital-loggers.com/script?edit027=AUTOPING+4&edit028=AUTOPING+5"
# edit just one individual line
url="http://admin:4321@epcr.digital-loggers.com/script?edit029=END"
# enable scripting
url="http://admin:4321@epcr.digital-loggers.com/script.cgi?robenable=on"

######################################################################
# Strings:
#
#edit strings:
# NB: multiple strings in one request not allowed
url="http://admin:4321@epcr.digital-loggers.com/str.cgi?str25=192.168.1.5"
#several identical strings:
url="http://admin:4321@epcr.digital-loggers.com/str.cgi?str[10-19]=Hello+World"

######################################################################
# Autoping:
#
#set autoping parameters
url="http://admin:4321@epcr.digital-loggers.com/autoping.cgi?pint=50&pthr=5&ptrl=1&prtr=10&pdel=120"
#erase autopings 3 (base 0) and above:
url="http://admin:4321@epcr.digital-loggers.com/autoping.cgi?pid=3&del"
url="http://admin:4321@epcr.digital-loggers.com/autoping.cgi?pid=3&del"
url="http://admin:4321@epcr.digital-loggers.com/autoping.cgi?pid=3&del"
url="http://admin:4321@epcr.digital-loggers.com/autoping.cgi?pid=3&del"
url="http://admin:4321@epcr.digital-loggers.com/autoping.cgi?pid=3&del"
#create new autopings
url="http://admin:4321@epcr.digital-loggers.com/autoping.cgi?ip=5.5.5.5"
url="http://admin:4321@epcr.digital-loggers.com/autoping.cgi?ip=6.6.6.6"
#enable and set outlets
url="http://admin:4321@epcr.digital-loggers.com/autoping.cgi?pid=4&pen=on&perm3=on&perm4=on&perm5=on&chp"
#enable and set script
url="http://admin:4321@epcr.digital-loggers.com/autoping.cgi?pid=3&pen=on&script=17&chp"
 


  • Have a smart script or unique way to use your switch?  We'll acknowledge your contribution. engineering@digital-loggers.com