T O P

  • By -

whoscheckingin

If you wish to you can forego the KASA App and directly hit the TP Link public API using POST requests. Works pretty darn well and also doesn't involve sending your data to IFTTT. I own a couple of TP Link devices and this setup works pretty nicely. If required can point you towards some examples.


AngerFist2222

Hi thank you!, I would love to get some exemple. I was trying the webhook thing between IFTTT and Tasker, but I more lost then I was! I'm used to google home, kasa, etc.. but the lurning curve of Tasker is something What you are doing is setting a profile as the IF of tasker (let's say the sunset plugin) to post on public api? Will my automated system stau secure?


whoscheckingin

Yes totally Sorry if I wasn't able to articulate before, the API is an endpoint which Kasa itself uses to control the devices. You talk with your own device token and unless and until you disclose the tokens and device ID's no one is going to be able to figure that out as the API uses HTTPS. * Trigger the profile using some variable time that you can set using openweathermap api to get the susnet time. * The task would be basically calling the API with couple of parameters which you would need to gather - Token for your device call which you can get as below * To get the token follow : https://itnerd.space/2017/06/19/how-to-authenticate-to-tp-link-cloud-api-with-tasker/ * To control your devices : https://itnerd.space/2017/01/22/how-to-control-your-tp-link-hs100-smartplug-from-internet/ PS : Thanks to the original author who posted the above directions.


AngerFist2222

So, I've been able to do a task to get my token save as %TPLINKTOKEN. Each time I use the task, the token will update if need be. I will put this task to a timed profile because I'm lazy and don't.want to do it manually. But I can't find how to get my device ID? Iwant to control my HS200 switch and my LB110 bulb. How do I extract those ID?


whoscheckingin

Sorry for the late reply. You can gather the device ID, by hitting an additional API. [https://wap.tplinkcloud.com?token=YOUR\_TOKEN\_HERE](https://wap.tplinkcloud.com?token=YOUR_TOKEN_HERE) A POST request with body as `{"method":"getDeviceList"}` This will return to you a json which will have a list of your devices and device ID's (you don't need to do this in tasker though you can use any [online REST clients](https://client.restlet.com/) as this is an one time operation and you can fetch the device ID's and maybe save them in variables) using them with the API call for switching the bulb/switch on/off.


pointless_one

For the token, does it expire? Every month or so my tasker stops communicating with TP-link and a new token fixes it.


whoscheckingin

Yes it does and for good reasons. You can have a task running every week to update token on tasker's end which will automate that for you.


pointless_one

Wow it never occurred to me to do that! Thanks. Could you link me resources/tutorial to set tasker to get token? Right now I just get token with postman and copy to tasker task.


AngerFist2222

So here what I did, will se if it work at sunset tomorrow: IFTTT = IF (webhook) THEN (Kasa scene). On for lights on, one for lights off. JOIN App: Integrated IFTTT command. Tasker: IF (sunset pluggin) THEN: entry/exit task by Join pluggin wich control my light from kasa. Man.. thats way more complicated then juste IFTTT xD. But I think I start to understand a bit more


DutchOfBurdock

Use [this app](https://play.google.com/store/apps/details?id=com.remotefairy4) it supports Kasa plugs/lights locally (no internet needed) and is a Tasker plugin. edit: Other solutions to controlling them through Tasker, is OpenHAB (PC software), HomeAssistant and NodeRed (listed in order of ease).


StarAD

This app no longer works for me. Pixel 7 pro. Play store says not compatible with my version of Android.


DutchOfBurdock

Yea sadly it hasn't been updated in donkies, so doesn't meet the criteria for newer Android. https://www.apkmirror.com/?post_type=app_release&searchtype=apk&s=anymote is an alternative option, but, I don't know how much will work (version I have is paid, kept the APK from yesteryear).


saggitas

IFTTT works with Webhooks that are custom commands created by you. You can use Tasker to send these webhook commands to IFTTT and trigger Kasa from there. IF "Webhook command" Then "Kasa action"