codetheweb / tuyapi

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

Typo and intermittent failures from last merge #41

Closed tomporter518 closed 6 years ago

tomporter518 commented 6 years ago

It looks like there might be a typo at (line 356):

client.on('error', err => {
    error(e);
});

e should actually be err.

I'm also seeing failure with this merge to consistently control my switches where the previous version had no issues. I do not believe the above typo is the cause, but I did find it because of the failure to set state. It could be messing with my retry logic however.

codetheweb commented 6 years ago

Yeah, sorry about that and other potential issues you've been seeing.

I've been using master for developing, as I assumed users would always have the latest stable version since I have to manually publish versions to NPM. I should probably start using a develop branch.

tomporter518 commented 6 years ago

I have NOT cloned the project. I only use npm but it does seem that when I npm update tuyapi, it will pull from master. FWIW, manually fixing the typo in my tuyapi/index.js has returned my script to reliable operation. I have some retry logic for when the device(s) report back an error. That was failing to get invoked because of the typo.

codetheweb commented 6 years ago

npm update does pull from master, but it uses the latest tagged version, so you should be good there. I have no idea why NPM would use the latest (untagged) commit. I just tested it out by creating a new folder, running npm init && npm i tuyapi -S and it correctly installed tuyapi @ 2.0.3. The line of code that you quoted above was not present in index.js.