Smart plug API

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
12

Smart plug API

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
Smart plug API
Smart plug API
2017-12-26 07:12:25
Model :

Hardware Version :

Firmware Version :

ISP :

Hi! It's my first post in the forum.

I would like to know where I can find information about the smart plug API.

All the best,
Danilo
  0      
  0      
#1
Options
12 Reply
Re:Smart plug API
2017-12-27 19:09:10
Github. Go ahead.
  0  
  0  
#2
Options
Re:Smart plug API
2018-01-05 00:56:25
What are you looking to do with the API, Danilo?

If its list devices, see status, turn on, turn off, I've had some joy marshalling these calls via the TP-Link API ( tplinkcloud.com).

There's a few hops you have to go through (create a UUID, get a token, understand the specific JSON required to access / read the API) but its nothing too complex.

You can pull all of my code from here, or try it out on codepen (see links in the git hub readme).

Andy
  0  
  0  
#3
Options
Re:Smart plug API
2018-01-08 07:34:42
I am mostly interested in the power comsuption monitoring feature of HS110.

Is there any way to achieve that without a third-party service?
  0  
  0  
#4
Options
Re:Smart plug API
2018-01-08 18:22:30
If you want to get this resource from TPLINK then you can give up. They NEVER, never give the code to you.
  1  
  1  
#5
Options
Re:Smart plug API
2018-01-09 01:47:33
I can see the JSON requests I'm making return emeter data that looks like it might be relevant:

"emeter": {
"get_realtime\":{"
current ":0.012146,"
voltage ":232.028969,"
power ":0,"
total ":0.051000,"
}
}

I'd have to dig in to see if this is the power consumption you're after. Voltage, Current, Total, could be a thing...
  0  
  0  
#6
Options
Re:Smart plug API
2018-01-09 07:07:54

Anton L.Z. wrote

If you want to get this resource from TPLINK then you can give up. They NEVER, never give the code to you.


If that's true, that's a retrograde business mindset. Open API is a requirement for IoT's evolution.

I realized there was some effort to hack it on github. I just would like to know if an Open API it's officially supported.
  0  
  0  
#7
Options
Re:Smart plug API
2018-01-10 01:35:02
Well, it looks to be possible.

Please see screenshot below, captured from a new PowerUsage branch at github, showing realtime power consumption in the console.



  0  
  0  
#8
Options
Re:Smart plug API
2018-07-05 19:18:58
Hi Arallsopp, appreciate the work you've done with this web client. Just wonder if it's still working, coz i've tried it at codepen at: https://codepen.io/arallsopp/pen/pdZQWG and it's giving me errors while looking at the console. I've blanked out my token and device id for obvious reason. It says


"Possibly unhandled rejection: {'data':null,'status':-1,'config':{'method':'POST','transformRequest':[null],'transformResponse':[null],'jsonpCallbackParam':'callback','url':'https://use1-wap.tplinkcloud.com?token=XXXXXXXXXX','data':{'method':'passthrough','params':{'deviceId':'XXXXXXXXXX','requestData':'{\'system\':{\'get_sysinfo\':null},\'emeter\':{\'get_realtime\':null}}'}},'headers':{'Accept':'application/json, text/plain, */*','Content-Type':'application/json;charset=utf-8'}},'statusText':''}"
  0  
  0  
#9
Options
Re:Smart plug API
2018-07-14 07:35:11

akumi wrote

Hi Arallsopp, appreciate the work you've done with this web client. Just wonder if it's still working, coz i've tried it at codepen at: https://codepen.io/arallsopp/pen/pdZQWG and it's giving me errors while looking at the console.


Hmmm... I've just tried it in firefox and safari on my mac, and it seems to be happy enough with my creds, finding all of the devices I'd expect to see.

Mind you, trying it in chrome results in a NET::ERR_CERT_SYMANTEC_LEGACY failure, seemingly as Chrome 66 beta distrusts all Symantec SSL/TLS certificates issued before June 1, 2016. Wonder if they're planning to update the certs at https://wap.tplinkcloud.com/ any time soon.

Just so as we can rule out a certificate error, can you let me know what browser you're using, and then try to load https://wap.tplinkcloud.com/
My experience is that the browser will either refuse to make your request with a 'your connection is not private' error, or the service will reject your request with a 'Request method 'GET' not supported' warning. For me, any browser that makes it to the second warning works fine.
  0  
  0  
#10
Options
Re:Smart plug API
2018-07-15 09:57:17
Hi Arallsopp,

Thanks for your reply, i'm using google chrome and i'm getting 'Request method 'GET' not supported' warning' when i go to https://wap.tplinkcloud.com.

For some reason i retried it today and seems to be working, it's spitting out different code in the console section compared to yours (image attached). I can't find the section where it shows the power consumption like amps and voltage as shown on your screenshot.




  0  
  0  
#11
Options

Information

Helpful: 0

Views: 32800

Replies: 12

Related Articles