Digital Loggers




 

Compatible Devices

IFTT control can be implemented in all our  WiFi power control products like 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.

 

For example, let's assume you'd like to turn a fan on on Outlet 5 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 outlet5", as "THAT", you'd need this three-step 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. After you have internet access, 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

3. 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/0/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).

 

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