In my previous post we saw how we can control a TP-Link HS100 smart plug from command line from anywhere on Internet, without the Kasa app. In this post we’ll see how to switch the plug On/Off directly from IFTTT, without any third-party component, nor without any other device at home other than the smart plug itself.
In IFTTT we’ll use the Maker service, which let’s us call a custom HTTP GET/POST request with some Json payload, so that’s exactly what we need here.
Note: If you haven’t already, follow the steps in my previous post, to figure out what your Token and Device ID are.
Then create a new Recipe Applet like you normally would in IFTTT, and choose the “Maker Webhook / Make a Web Request” action service to define a new action.
For the URL, I’ve used:
https://eu-wap.tplinkcloud.com/?token=YOUR_TOKEN_HERE
and the method type is POST.
Note: For the URL: please read this other post, as you might need to use a different URL depending the region where you are from.
The Content Type is application/json, and the payload to switch the plug On should be:
{"method":"passthrough", "params": {"deviceId": "YOUR_DEVICEID_HERE", "requestData": "{\"system\":{\"set_relay_state\":{\"state\":1} } }" } }
If you want to switch the plug Off, just replace the state 1 with state 0.
Notice how I have added extra carriage returns to separate the “}” at the end, otherwise IFTTT was giving me some error.
That’s it! Easy, right?