How to use a SmartLife power plug using IFTTT

HI,
I’d like to share my integration with a SmartLife power plug and Voyager using the IFTTT platform, in order to drive the switch off of all my gear in a dragscript when I terminate the sessions at end of the night.
I have not any complex power relays system, just a common single smart power plug (SmartLife system), upstream all my power supplies (mount, CCD, filterwheel, dew shield heater…).

smart plug

Of course, you can use the smart plug as a timer, interrupting the power at a specific time late in teh morning, but with this integration, I am able to insert the power off command in my dragscript at end of my session.
I use the IFTTT platform with “webhooks” trigger mechanism and “SmartLife” action.
The IFTTT WebHooks behaviour is to create a web service dedicated to you (there is a dedicated key for you), and the applet will perform as:

IF you call the WebHook(event,YourKey)
THEN
exec SmartLife Scene
ENDIF

Here the steps:
First, if you have a smart power plug, I assume you already have a SmartLife App and account, and you already know how to use it. You need to create and configure a Scene in SmartLife App on your smartphone (please note that in IFTTT the selection of single device doesn’t work, so you have to create a very simple scene with your smartplug device and just a single OFF action):

Then, let’s go on ITTT website (https://ifttt.com/) , and create an account in case you haven’t it.

Go to a Services, search for “Webhooks” service, click on it and connect.

After that, you can see your “hook” web service in “setting” panels.

here the settings:

Please, take note of your WebHooks “KEY” , you’ll need this key later.

Now you have to connect the smartLife service: again, go services, search for Smart Life and connect it. You will be asked for your smartlife credentials.

Ok, now that you have connected at the two services, let’s go to link them creating our Applet in IFTTT.

Click on ADD, search for Webhook and select it:


Write your Event Name. Please take note of the event name: You have to use it later in the script to invoke the webhook. Create the Trigger.

Click now on “Then That (Add)”:

Search for Smart Life service and select it. Please, note you cannot use, as action, “Devices” in IFTTT/smartlife service, but only “Activate Scene”. Select it, and from drop down menu select your “Scene” previously created in SmartLife app. “Create” your Action.

Well Done. Now your action is created and you can trigger it via Web call :

https://maker.ifttt.com/trigger/gear_off/with/key/{yourWebHookKey}

Do not share your WebHookKey, because you are exposing your device on the web!!
Now, in order to trigger the applet in Voyager, we need a simple script to use in the DragScript. Just open Notepad and write:

curl -X POST https://maker.ifttt.com/trigger/gear_off/with/key/{yourWebHookKey}

“gear_off” is the name of your webhooks, and yourWebHookKey is the related key.

Save the script as “telescope off.bat” ar any other name you want.

Now you can use this simple script in Dragscript or, for example, in Sequence configuration at goodnight!

Of course, with the same trick you can also create a power ON applet. Or, in case you have a multiple wifi smart plug, different triggers for any plug.
You have to create the IFTTT applet and the script once, and then use it forever in any script.
Hope this could be usefull for others.

Fabrizio

4 Likes

Thank you so much Frabrizio,

wonderful idea and thank you so much for the report and for sharing it.

All the best
Leonardo

Thanks Frabrizio, great setup!

I’ve done the same sort of thing with the Kasa wifi connected plug. If anyone is interested in using Kasa plugs let me know

cheers

Nick