Comments (5)
Yeah, I'm not completely sure what the best solution is here. There's three possibilities:
- Formatting is perfect, none of the padding renders as an ASCII character and
numOfLeftBrackets == numOfRightBrackets
- Random padding results in
numOfLeftBrackets > numOfRightBrackets
- Random padding results in
numOfRightBrackets > numOfLeftBrackets
I'm not really sure what to do. One interesting thing to note is that I've never seen a }
before the main payload, although that's most likely due to chance and not design.
The best way to parse returned data would be to simply start parsing at a certain index in the string like the actual device does, however this would add complexity as we would need to add the index to requests.json
.
from tuyapi.
Is the message returned from the device encrypted or plain text?
from tuyapi.
The majority of the time it is returned in plain text. However, there seem to be a (very) few random times when it's returned encrypted. I have no idea what triggers this. If it's returned encrypted, a JSON error will be thrown.
from tuyapi.
@codetheweb for the moment, let's loop over min(rightBrackets, leftBrackets)? I hit the infinite loop with the following returned data (devID
modified):
00 00 55 AA 00 00 00 00 00 00 00 0A 00 00 00 44 00 00 00 00 7B 22 64 65 76 49 64 22 3A 22 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 22 2C 22 64 70 73 22 3A 7B 22 31 22 3A 66 61 6C 73 65 2C 22 32 22 3A 30 7D 7D B6 7B 49 82 00 00 AA 55
which roughly translates to:
��U™������� ���D����{"devId":"dddddddddddddddddddd","dps":{"1":false,"2":0}}∂{IÇ��™U
Notice the extra '{' at the end.
from tuyapi.
Fixed.
from tuyapi.
Related Issues (20)
- 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
- Smart plug doesn't return Received data 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.