Digital Loggers

Python Scripts


Special thanks to our valued customer Dwight Hubbard for these handy Python scripts and examples.  They've been tested on all DLI power controllers.


Mr. Hubbard has re-written the demo to eliminate cURL. The newest version is on the python pypi repository (
The source is on github (

Thanks again, Dwight.



For those interested only in the WiFi capable power controllers, Hammock is quite
sufficient to obtain a convenient REST API interface.
Sample code:

from hammock import Hammock
from requests.auth import HTTPDigestAuth
import time

auth = HTTPDigestAuth('admin', '1234')
pcr=Hammock("",append_slash=True,auth=auth,headers={'X-CSRF': 'x'})

print (pcr.auth.users.GET().json())
# [{u'outlet_access': [True, True, True, True, True, True, True, True], u'password': {u'$ref': u'0/password/'}, u'is_allowed': True, u'is_admin': True, u'name': u'admin'}]
print (pcr.auth.users(0).outlet_access.GET().json())
# [True, True, True, True, True, True, True, True]
pcr.relay.outlets(0).state.PUT(json=True) # Relay 0 switches on

# Relay 1 starts switching on
for i in range(1,8):
    outlets(i).state.PUT(json=True)  # outlets 1-7 switch on

for i in range(8):
    outlets(i).state.PUT(json=False)  # all outlets switch off
print (pcr.auth.users("is_admin=true").name.GET().json())
# admin