🌧 An easy-to-use API for devices that use Tuya's cloud services. Documentation: https://codetheweb.github.io/tuyapi.
Update README.
Versions 6.2.x and up may be breaking: https://github.com/codetheweb/tuyapi/issues/448.
The behavior described here is now opt-in, instead of being enabled by default.
Update your code to new TuyAPI({... nullPayloadOnJSONError: true})
if you wish to keep this behavior enabled when upgrading.
This release focuses on reliability updates.
The only breaking change is that .set()
will now resolve with the new status, instead of true
(see docs for details).
The majority of changes in this release deal with simplifying TuyAPI's code for better readability and maintainability, as well as simplifying the interface.
.get()
and .set()
will now both emit an event and return a Promise simultaneously, no extra options needed. In practice, this means TuyAPI gets out of your way and lets you decide if you want to use the synchronous-style callbacks or event-based programming (or both) with less friction.DEBUG=* ...
is a little less overwhelming and easier to understand..resolveId()
was renamed to .find()
, as the function can now resolve either a missing ID or missing IP. For compatibility purposes, .resolveId()
now wraps .find()
; but .resolveId()
is deprecated and will be removed in v5.0.0..resolveIds()
was removed. It previously wrapped .resolveId()
for compatibility purposes..connect()
before interacting with a device, and .disconnect()
when you want your script to exit.
Fixes XO build errors.
Improves stability, and adds a timeout when resolving a device ID to an IP.
Includes
Because functions now return Promises, this is a breaking update. Make sure you update your code appropriately.