codetheweb / tuyapi

🌧 An easy-to-use API for devices that use Tuya's cloud services. Documentation: https://codetheweb.github.io/tuyapi.
MIT License
2.04k stars 332 forks source link

is there a breaking change at tuya ? #641

Open geertschneider opened 7 months ago

geertschneider commented 7 months ago

Describe the bug I'm trying to connect to my devices through this library. But seems to hang on Error: find() timed out. Is the device powered on and the ID or IP correct? I'm sure deviceID and localKey are correctly filled in. I tried the same with CURL (generated by the tuya API explorer), and those requests pass, but trying to connect to the same device via the library fails.

I also tried node-red, which uses the same library under the hood.

Any idea ?

Apollon77 commented 7 months ago

find is using UDP to find the device IPS, so it really depends on your configuration ... make sure UDP is available and correctly routed

geertschneider commented 7 months ago

Thanks for your reply!

Well I was running node-red in a container, I can imagine the networking might be an issue there...

I didn't look at the code of tuyaapi, I thought the library was just created a developer-friendly wrapper on top of the tuya REST api, and as I could execute the REST API from the node-red container, I was expecting it to work via the tuyaapi as well.

But than I just ran the library from nodeJS from the command line with a basic .find(deviceID,localKey). The tuya app runs on the same wifi network, and my PC runs without issues, so I would not expect to have to do something special for UDP on my laptop/network?

kueblc commented 7 months ago

This library is for communicating with Tuya devices on your local network, it does not interact with the cloud.

Apollon77 commented 7 months ago

in a container

Then use macvlan on the container to have UDP forwarded

stappersg commented 6 months ago

in a container

Then use macvlan on the container to have UDP forwarded

That makes sense, so now I'm poking @geertschneider

RoffelKartoffel commented 4 months ago

This library is for communicating with Tuya devices on your local network, it does not interact with the cloud.

Oh My Lord.... thank you for pointing that out. I had the very same problem and stumbled upon this "issue" by chance. This error message realy is not that self-explanatory. :innocent: