-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Unhandled 'error' event #382
Comments
There is a new 'feature' in the latest Tuya release it seems... The local api (or at least the endpoint we most use) is not available until you've had contact with the Tuya app. If you open the app interact with the device and then close the app (maybe even do 'Force stop' of the app as it stays sometimes running in the background) and then try to connect again, is the use then maybe resolved (if this is the root cause of the exception)? |
Thank for your suggestion. I tried doing the above but I'm experiencing the same error. I tried rolling back to a version of Smart Life app from October. Do you have any other suggestions? |
No sorry this is the only issue I've run into when using this api. Probably a different root cause then. |
Thanks. Maybe @codetheweb can help? |
Have you tried using the 3.1 protocol? Also, what kind of device do you have? |
With protocol 3.1, I get a 'parse data error'. The device I am using is a LSPA7 UK Smart Socket. |
Hmm. It's possible that this is related. Could you try the event-based example in the README and see if you have the same issue? |
So I copied the example and edited in my id and key and saved the file as async.js file. Then I ran 'node async.js'.
I'm not sure if the above is the correct way of running the script. |
I had same problem
One of my devices give me error. (moes socket) I had try async and await reguest - no matter; api.find();
api.connect()
//if try get properties
api.disconnect()
|
I seem to be getting a new error now and running a set command @codetheweb :
|
Please post the full debug output. My guess is that another device (phone, server, etc.) is trying to control it at the same time. |
I'm having the same issue and as for @bb165source command switches the device on/off successfully:
Running the event-based example results in error below:
After setting the issueGetOnConnect: false it returns no data:
I've also tested the synchronous version and it seems to work beside gathering the the schema with "device.get({schema: true}).then(data => console.log(data))" which results in:
|
This sounds very similar to the behavior described here: #389. |
I have the same problem if I set the IP of the device. If I do not set it, tuyapi waits for the UDP broadcast and then everything is fine. I tried on a local Wi-Fi with no internet and no other clients than the tuya device and I have the same error so I can tell you that nothing else is accessing the device at the same time. |
This likely means that you're setting the wrong version in the constructor / omitting it entierly. Try both |
No details, no follow up infos. closing. Please reopen if still relevant and happening with most recent versions. |
I keep running into a Unhandled 'error' event each time I seem to run a get or set command.
I have successfully managed to retrieve the keys and the Virtual ID after configuring it with tuya-cli wizard. but then when I run DEBUG=* tuya-cli get --id xxx --key yyy --ip 192.168.2.X --protocol-version 3.3 --all
If I run tuya-cli set --id xxx --key yyy --ip 192.168.2.X --protocol-version 3.3 --dps 1 --set true (or false)
I still get the same error as above, but funnily my plug switches on (or off).
I'm not sure where I am going wrong.
The text was updated successfully, but these errors were encountered: