Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P110 getting current energy usage via different api method #109

Closed
Michal-Szczepaniak opened this issue Aug 21, 2023 · 9 comments
Closed

Comments

@Michal-Szczepaniak
Copy link
Contributor

I'm seeking help in adding support in p110 api to get current power draw, let me explain.

All my "smart" devices are on network without internet access for privacy and security concerns and i've noticed that if the device turns on and connects to that network or even looses connection and then reconnects, none of the get_device_usage,get_energy_usage,get_energy_usage work which in the tplink app i can see as no energy usage graphs whatsoever. To fix that you need to kickstart them with internet connection and then they work fine just fine. But while they are not working, i noticed in the app i could still see current power draw and fankly thats all i care about (on/off works fine), so i was hoping you could help me/we could work together on finding out that api method, but if you got P110/115 then you don't need my help :P

I'm happy to provide any information and help in any way i can to get it as it's stopping me from achieving perfection

@Michal-Szczepaniak
Copy link
Contributor Author

I've done a bit of reverse engineering on the app (i'm newb) and i've located CurrentPowerResult which returns ONLY currentPower which I strongly believe is the result i'm interested in, and the request is called get_current_power

@Michal-Szczepaniak
Copy link
Contributor Author

So far i tested the get_current_power and indeed, get_device_usage/get_energy_usage/get_energy_data all fail with different unknown tapo errors and get_current_power does indeed return current power draw!

@Michal-Szczepaniak
Copy link
Contributor Author

Imma close this now since it's merged and I was able to do it myself :P

@mihai-dinculescu
Copy link
Owner

It's been released in v0.7.2. Thank you!

@Michal-Szczepaniak
Copy link
Contributor Author

@mihai-dinculescu what do you think about adding rest of functions

@mihai-dinculescu
Copy link
Owner

I'm all for adding whatever it's helpful to people.

What do you have in mind?

@Michal-Szczepaniak
Copy link
Contributor Author

Michal-Szczepaniak commented Aug 21, 2023

While looking at the apps code i just noticed some other functions, might not be exactly useful but full api coverage would be good no?

+ i'm gonna add small thingy to generate mappings for c++ which i used for my project

@mihai-dinculescu
Copy link
Owner

I don't think that full API coverage should be a target in itself because:

  • the API is private, and Tp-Link might pull the plug on it or revamp it any day
  • there is no documentation, and some of the endpoints, especially the ones that change the state of the device, are quite time-consuming to figure out how they work

However, if someone needs a particular function, I'll gladly support its addition.

If you're looking into adding FFI-related stuff, you might want to look at and/or branch off #100.

@Michal-Szczepaniak
Copy link
Contributor Author

Oki gotcha that makes sense

Hmm but thats for python gotta add bindings for c++ along with cbindgen :P But well this is not issue for that

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants