Comments (8)
First make sure you're running the latest version of tuyapi
. Running npm list tuyapi
should result in output starting with [email protected]
.
If that looks good, your device may be the problem. Maybe it uses a slightly different protocol. Try running your test script a few times and see if the issue crops up each time.
from tuyapi.
One of the things I've not yet had time to do is add debug trace logging to https://github.com/clach04/python-tuya for this sort of scenario where the response payload is unexpected.
from tuyapi.
@codetheweb thank you for you're reply. Ran npm list tuyapi
and the output was [email protected]
Ran the test script 6 more times with the outlet starting in the turned on state and the result as I posted originally was the same each time.
Ran the test script a few more times with the outlet starting in the turned off state and the result is slightly different, in that in cannot return the status at all, goes right to the:
SyntaxError: Unexpected token � in JSON at position 56 at Object.parse (native) at _send.then.err (/home/utladmin/node/tuyapi/node_modules/tuyapi/index.js:64:19) at process._tickCallback (internal/process/next_tick.js:109:7)
Seems like the getStatus cannot communicate with the device when it's in the off state. The specific device I'm working with the MartinJerry mini Smart Plug.
Totally could believe that that this specific device is slightly different than what you guys are working with. I may also try to re-run through the instructions on how I pulled the access info (uid, key, etc) and see if I see any different/additional details.
Thanks again for everyone's time looking into my post, I do appreciate it.
from tuyapi.
Weird. I'm currently really busy, but I'll try to add a flag to the constructor in the next few days that outputs some debug information to the console. Hopefully that helps us pin down this issue.
from tuyapi.
I think I know what is going on... I've no idea why though 🎱
Sometimes status returns an encrypted payload. Again I've no idea why/when this occurs. I can induce this sometimes by making a bunch of status requests in a row. See clach04/python-tuya#6 for a Python test case (and fix).
I've resolved this by decrypting the result and sending back the status dictionary. What is interesting is that this payload has additional keys. t
is epoch seconds, s
I'm still trying to workout.
from tuyapi.
This should be fixed by v2.0 @danlakey. Please update tuyapi
, update your code (v2.0 includes breaking changes), and it should now work.
from tuyapi.
Apologies for the late response, guys. Winter storms knocked out my system and just got everything back online. The change v2.0 worked! I updated from NPM, then used the updated sample code and was able to turn the switch on/off. Thank you!
from tuyapi.
Glad to here it.
from tuyapi.
Related Issues (20)
- Error: GET_TOKEN_FAILED 1114, your ip(xxx.xxx.xxx.xxx) don't have access to this API HOT 1
- Some of my localtuya devices periodically become unavailable HOT 2
- App show "no access". I turn on all permissions when creating new Cloud Project. And I cheched my region. All right. HOT 1
- Implement 3.5 protocol
- Setting brightness overrides color / set multiple properties only applies last HOT 2
- Weird encrypted response from tuya bulb ? HOT 6
- Philips Avent Baby Monitor uses Tuya HOT 3
- Virtual device timed out HOT 1
- Tuya IOT Platform error 1106: permission deny HOT 1
- Cannot install with "npm install codetheweb/tuyapi" HOT 1
- device.get() never returns HOT 9
- Not being able to connect using device.connect() HOT 7
- tuya-cli get does not work, ECONNRESET error. HOT 1
- 302 status on my TuyaPlatform plugin HOT 1
- `dp-refresh` fire for all devices of the gateway instead of the only one concerned HOT 1
- is there a breaking change at tuya ? HOT 6
- Use Insecure Algorithm AES-ECB as Default Encryption Method HOT 1
- npm install codetheweb/tuyapi Infinite loading occurs during installation.
- virtual ID HOT 1
- Just lost all my Local Tuya devices HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tuyapi.