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

Failed to obtain device ip #583

Closed JaRoLoz closed 2 years ago

JaRoLoz commented 2 years ago

Describe the bug I registered my device as shown in the tutorial and copied the boilerplate code on the npm page. When running the code it gives a timeout error on the device.find() method. But when i add the ip propperty to the device constructor it works.

Expected behavior It should turn off and on the the iot device either way.

Debug Output

  TuyAPI Finding missing IP undefined or ID 51283827cc50e3xxxxxx +0ms
C:\Users\Jaime\Desktop\ZCore\node_modules\tuyapi\index.js:833
      throw new Error('find() timed out. Is the device powered on and the ID or IP correct?');
            ^

Error: find() timed out. Is the device powered on and the ID or IP correct?
    at C:\Users\Jaime\Desktop\ZCore\node_modules\tuyapi\index.js:833:13
    at Timeout._onTimeout (C:\Users\Jaime\Desktop\ZCore\node_modules\p-timeout\index.js:25:13)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)

Screenshots image

Desktop (please complete the following information):

Additional information I´ve tried with others devices and they haven´t worked.

JaRoLoz commented 2 years ago

I finally made it work, i simply changed the nodejs version to v18.0.0