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

[FEATURE REQUEST] Show power information for smart sockets #4

Open
KaMyKaSii opened this issue Jul 23, 2022 · 6 comments
Open

[FEATURE REQUEST] Show power information for smart sockets #4

KaMyKaSii opened this issue Jul 23, 2022 · 6 comments

Comments

@KaMyKaSii
Copy link

I would like to be able to see this information without relying on my smartphone. Thank you.

@ndg63276
Copy link
Owner

What model number do you have?

@KaMyKaSii
Copy link
Author

This one. If you need the Smart Life app private traffic I can provide it for you.

@ndg63276
Copy link
Owner

If you open the developer console (F12 key usually) and type

device_list

You should get a list of your devices. If you expand the details for the smart socket, you could see if the information is already in the data the website gets from Smartlife. If it is, I can add it to the website. If not, I can't.

@webmake
Copy link

webmake commented Aug 23, 2022

I think my needs match the author's feature request. So I analyzed library scripts, and I see that only 3endpoints are used:
auth.do
access.do
skill

But for measuring consumption, there is "logs" endpoint. I used tuya cloud explorer. From documentation:
GET /v1.0/devices/xxxid/logs?start_row_key=xxxx_1&type=1,2&start_time=1545898159931&end_time=1545898159935&size=20

or real example:
curl --request GET "https://openapi.tuyaeu.com/v1.0/devices/xxxx_1/logs?end_time=1761779264392&start_time=0&type=7" --header "sign_method: HMAC-SHA256" --header "client_id: xxxxx" --header "t: 1661293844933" --header "mode: cors" --header "Content-Type: application/json" --header "sign: yyyyyy" --header "access_token: zzzz"

where 7 data point report,
(Types supported by log query. Supports query of multiple event types, separated by commas (,), must be transmitted. (1 online, 2 offline, 3 device activation, 4 device reset, 5 instructions Issue, 6 firmware upgrade, 7 data point report, 8 device semaphore, 9 device restart, 10 timing information))

and results are paginated.

My device is:
"model": "SMART PLUG-WIFI-D",
"name": "SMART PLUG",

Could you add support for visualizing power consumption?
That's what I managed to draw from logs via excel
image
It seems data is enough for that

Thanks

@ndg63276
Copy link
Owner

Oooh, nice work. Gonna be hard though, my site is using an old API set up for homeassistant, https://px1.tuyaeu.com/homeassistant/. Can you point me towards the documentation you mention? Did you have to register to use openapi.tuyaeu.com? And what smart plug do you have?

@KaMyKaSii
Copy link
Author

@webmake from where you get the access_token value? I'm intercepting the Smart app (Android) traffic with ssl pinning disabled but with the calls to
https://a1.tuyaus.com/log.json I can only get other parameters like cliendId, sign, deviceId, sid, ttid...

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

3 participants