tinytuya icon indicating copy to clipboard operation
tinytuya copied to clipboard

general question: local http requests to tuya device?

Open Hans-Maulwurf opened this issue 1 year ago • 4 comments

Hey guys,

I'm delighted that I found tinytuya, I have a Moes Smart Wifi Dimmer and it looks (for now) that I am able to somehow control and read it via tinytuya. The more I read about tuya environment, I see openAPIs specs and wonder, if it's possible to control the device by pure local http requests. Can somebody point me to a doc or the api spec that is really working directly to the device and not to the cloud?

Hans-Maulwurf avatar Sep 23 '24 09:09 Hans-Maulwurf

when I'm in the tuya api explorer, I see on the right a curl command with url, e.g. https://openapi.tuyaeu.com/v2.0/cloud/thing/b...

since tuya devices offer a local api on port 6668, I wonder, how to modify this url to the local ip and send the request to the device

Hans-Maulwurf avatar Sep 23 '24 10:09 Hans-Maulwurf

The curl commands are for the cloud API. The devices locally do not use http, thus the need for this library to communicate with them locally.

make-all avatar Sep 23 '24 22:09 make-all

ok, fair point

Hans-Maulwurf avatar Sep 24 '24 11:09 Hans-Maulwurf

Hi @Hans-Maulwurf, if you want more details on the protocol (how Tuya devices are accessed via the local API), you might like this great write up by @uzlonewolf : https://github.com/jasonacox/tinytuya/discussions/260

jasonacox avatar Sep 25 '24 03:09 jasonacox