Digital Loggers




HTTP Power Switch Control Examples

Note: for new designs, we recommend the RestAPI here.
Also for new (WiFi capable) designs, to use the legacy commands below using curl, you will need to allow legacy access.

 

To use HTTP, after authenticating, send a request to port 80 (or other port specified on the Setup page) to retrieve an HTML page with status.  The current outlet state and lock status can be found in hex in the page source:
 

  <!-- state=81 lock=10 -->
 

The outlet status 0=OFF, 1=ON.  For example, 0x81 means outlet 8 (0x80) and outlet 1 (0x01) are both on.  The lock byte indicates the lockout status for the outlets.  For example, 0x10 means out 5 is locked, others are unlocked. 

NB: You can only have visibility to the outlet states you are permitted to see on the setup page.  For example, admin can view the status of all outlets.   A user granted permission to outlets 1 and 2 would only see the lower bits 0x01 and 0x02; others are always zero.

To get the status ad described above:
http://192.168.0.100/status

Control of outputs is accomplished via GET requests.  For example:

To turn Outlet 2 ON:
http://192.168.0.100/outlet?2=ON

To turn Outlet 5 OFF:
http://192.168.0.100/outlet?5=OFF

To cycle Outlet 7:
http://92.168.0.100/outlet?7=CCL

To start a script on line 90 at the default IP after authenticating admin with password 1234:

http://admin:1234@192.168.0.100/script?run090

This example turns all outlets (relays) on simultaniously in a DIN relay
http://192.168.0.100/outlet?a=ON   

* This is controlled by the "On sequence delay" in the setup page. Only the DIN relay can have a zero (0) second delay.


Using a browser to "view source" will reveal the available links.

Note: These commands are case sensitive.   Would you  like to control from your own application or via a script?   Have a look at cURL.

 
* Not all curl versions authenticate properly, such as the version that comes with Windows.
This version of curl is tested and works well.

 


We also provide a compiled example that runs from the Windows command line:

UserUtil <Host>[:port] <login:password> <[n]{on|off|pulse|status}>

Examples:

UU 192.168.0.100:80 admin:1234 5on  

<logs in as admin/1234 then turns outlet 5 on>
 

UU 192.168.0.100:80 admin:1234 status

<logs in as admin/1234 then requests status>


UU 192.168.0.100:80 admin:1234 5off 6off 7on

<logs in as admin/1234 then turns outlets 5 and 6 off and outlet 7 on>

Download the compiled API example, the Perl source, and PowerMan module here.

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