TuyaAPI / cli

🔧 A CLI for Tuya devices
MIT License
270 stars 44 forks source link

Getting data from a device is not working #93

Closed awaismun closed 4 years ago

awaismun commented 4 years ago

I am trying to get data from a device but tuya-cli does not seem to work. This is what I have tried so far:

tuya-cli get --id xxxxx --key xxxxx --ip 192.168.1.7 --all

This is not returning anything. Absolutely nothing.

Then I tried only this:

tuya-cli get --id xxxxx --key xxxxx --all

Response: Error: find() timed out. Is the device powered on and the ID or IP correct?

Then I tried PING 192.168.1.7 and got response from the device.

Last I tried this:

tuya-cli get --id xxxxxx --key xxxxx --ip 192.168.1.7 ----protocol-version 3.3

Response: true

What am I missing and why am I not getting the correct response?

codetheweb commented 4 years ago

What am I missing and why am I not getting the correct response?

Sorry, not understanding the question. Looks like the last command returns a correct response.

If you're asking why find() isn't working, it's usually due to how your network is set up. I generally find it more reliable to configure my Tuya devices with a static IP and always specify the IP in my configs / scripts.

awaismun commented 4 years ago

Thanks for your reply.

Then this should work? This is what I have been trying for many hours now:

tuya-cli get --id xxxxx --key xxxxx --ip 192.168.1.7 --all

This does not give any reponse. Keeps going for hours.

codetheweb commented 4 years ago

When both the ID and IP are specified, you must specify the protocol version as well (defaults to 3.1).

In your first post, it looked like tuya-cli get --id xxxxxx --key xxxxx --ip 192.168.1.7 --protocol-version 3.3 was working. Add --all to that and it should work.

awaismun commented 4 years ago

Ah, it worked! Thanks alot 👍