Digital Loggers




 

Compatible Devices

IFTT control can be implemented in all power control products including the Ethernet Power Controller, the DIN Relay IV, the high power DC Power Switch, and the Web Power Switch Pro.   These products also contain a Lua scripting language Note that these products may be fully controlled using the recommended REST-ful API described here.
The legacy LPC-LPC7, EPCR2-3, DIN-DIN3, etc may also be conrolled via webhooks.

 

 

Perhaps you'd like to control you devices using Google Home or Google Assistant. In this case,
the if "THIS" side would be Google Assistant.


Or, perhaps you'd like to turn a fan on on Outlet 2 when triggered by a thermostat using IFTTT in between.  On the temperature side, "THIS", the code would totally depend on what you're using for a thermostat.

To "turn on outlet 2", as "THAT", you'd need this simple setup:

1. Get an IFTTT account. Make your power controller publicly accessible, with a good strong password. Depending on your network setup, this probably means getting into the port forwarding setup on your router. More on that here.

2. For WiFi capable controllers, enable "Allow legacy plaintext login methods" on the access settings area of the setup page.


3. After you have internet access, optionally enable the REST API.  This involves logging into the web power switch and making these two settings: Enable the REST API and tick the 'Relax non-HTML content type CSRF checks' checkbox because IFTTT can't be made to send custom header(s) required; then

4. Set up 'Webhooks" on IFTTT.  To do this, choose 'Webhooks' in the IFTTT web UI in when prompted to, enter the full URL to the REST API value you wish to change with the login and password (http[s]://user:password@.../restapi/relay/outlets/1/state/), choose 'PUT' as method (most likely you want to modify existing values, right?), choose 'application/json' as content type (this one is non-HTML so it's relatively safe to use), enter the JSON representation of the value (e.g. true or false, no quotes except if string literal; seems likely you'll need to quote it with <<< / >>> if it contains special characters, e.g. is a JSON object).

For legacy controllers, use the same URLs as the legacy HTTP and Curl commands. Of course, the newer WiFi compatable controllers can use the same format.


It's simple. Here are some examples:
Switch outlet 2 on (REST-Style API) Switch outlet 2 on (Legacy style) Run a legacy script starting at line 2 Run a script (POST) Run a script and pass parameters


A bit cumbersome, we know.  But it works well.  We do have requests in to IFTTT for simplification. Stay tuned.

 

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