question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parse Data Errors

See original GitHub issue

Hi,

Facing an issue with some new LED Strip Controllers. Originally bought these expecting to find an ESP inside to flash with Tasmota, but they use a W600 chip that rules that out…

Version of TuyAPI is 5.3.1.

I noted some similar issues (#23, #64), however all of those seemed to be resolved with protocol changes and some time ago - so wondering if this is yet another new protocol or similar…

Example Set commands:

DEBUG=* tuya-cli set --ip 192.168.2.Z --id XXXXX --key YYYYY --protocol-version 3.3 --dps 1 --set 1
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 192.168.2.Z... +11ms
  TuyAPI Socket connected. +59ms
  TuyAPI GET Payload: +1ms
  TuyAPI {
  TuyAPI   gwId: 'XXXXX',
  TuyAPI   devId: 'XXXXX',
  TuyAPI   t: '1595491332',
  TuyAPI   dps: {},
  TuyAPI   uid: 'XXXXX'
  TuyAPI } +0ms
  TuyAPI SET Payload: +12ms
  TuyAPI {
  TuyAPI   devId: 'XXXXX',
  TuyAPI   gwId: 'XXXXX',
  TuyAPI   uid: '',
  TuyAPI   t: 1595491331,
  TuyAPI   dps: { '1': 1 }
  TuyAPI } +0ms
  TuyAPI Received data: 000055aa000000010000000a0000002c000000011fd12f2145a2b4e48d0bc6f78454ef31ce04d93fc98d24d84e47a9045c13e0bd73b5e0ba0000aa55 +7ms
  TuyAPI Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('json obj data unvalid')
  TuyAPI     at TuyaDevice.emit (events.js:304:17)
  TuyAPI     at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:318:22)
  TuyAPI     at Socket.emit (events.js:315:20)
  TuyAPI     at addChunk (_stream_readable.js:295:12)
  TuyAPI     at readableAddChunk (_stream_readable.js:271:9)
  TuyAPI     at Socket.Readable.push (_stream_readable.js:212:10)
  TuyAPI     at TCP.onStreamRead (internal/stream_base_commons.js:186:23) +4ms
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('json obj data unvalid')
    at TuyaDevice.emit (events.js:304:17)
    at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:318:22)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Emitted 'error' event on TuyaDevice instance at:
    at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:334:18)
    at Socket.emit (events.js:315:20)
    [... lines matching original stack trace ...]
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
  code: 'ERR_UNHANDLED_ERROR',
  context: 'json obj data unvalid'
}
DEBUG=* tuya-cli set --ip 192.168.2.Z --id XXXXX --key YYYYY --protocol-version 3.2 --dps 1 --set 1
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 192.168.2.Z... +6ms
  TuyAPI Socket connected. +111ms
  TuyAPI GET Payload: +2ms
  TuyAPI {
  TuyAPI   gwId: 'XXXXX',
  TuyAPI   devId: 'XXXXX',
  TuyAPI   t: '1595491352',
  TuyAPI   dps: {},
  TuyAPI   uid: 'XXXXX'
  TuyAPI } +0ms
  TuyAPI SET Payload: +9ms
  TuyAPI {
  TuyAPI   devId: 'XXXXX',
  TuyAPI   gwId: 'XXXXX',
  TuyAPI   uid: '',
  TuyAPI   t: 1595491352,
  TuyAPI   dps: { '1': 1 }
  TuyAPI } +1ms
  TuyAPI Received data: 000055aa000000010000000a0000002c00000001341e53faf713cd68b0675c61c34f2a87a6efc804260729dec5b4d916506bdcf4c31a296e0000aa55 +22ms
  TuyAPI Parsed: +2ms
  TuyAPI {
  TuyAPI   payload: 'parse data error',
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 10,
  TuyAPI   sequenceN: 1
  TuyAPI } +0ms
  TuyAPI Received data: 000055aa00000002000000070000002c00000001341e53faf713cd68b0675c61c34f2a87a6efc804260729dec5b4d916506bdcf42f0215500000aa55 +15ms
  TuyAPI Parsed: +0ms
  TuyAPI {
  TuyAPI   payload: 'parse data error',
  TuyAPI   leftover: false,
  TuyAPI   commandByte: 7,
  TuyAPI   sequenceN: 2
  TuyAPI } +0ms
  TuyAPI Pinging 192.168.2.36 +10s
  TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +35ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
  TuyAPI Pong from 192.168.2.Z +1ms
  TuyAPI Pinging 192.168.2.Z +10s
  TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +51ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
  TuyAPI Pong from 192.168.2.Z +1ms
  TuyAPI Pinging 192.168.2.Z +10s
  TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +5ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
  TuyAPI Pong from 192.168.2.Z +1ms
  TuyAPI Pinging 192.168.2.Z +10s
  TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +97ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
  TuyAPI Pong from 192.168.2.Z +0ms
  TuyAPI Pinging 192.168.2.Z +10s
  TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +111ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
  TuyAPI Pong from 192.168.2.Z +1ms
  TuyAPI Pinging 192.168.2.Z +10s
  TuyAPI Received data: 000055aa00000000000000090000000c00000000b051ab030000aa55 +29ms
  TuyAPI Parsed: +1ms
  TuyAPI { payload: false, leftover: false, commandByte: 9, sequenceN: 0 } +0ms
  TuyAPI Pong from 192.168.2.Z +0ms
^C

Example Get Command

DEBUG=* tuya-cli get --ip 192.168.2.X --id XXXXX --key YYYYY --protocol-version 3.3 --all
  TuyAPI IP and ID are already both resolved. +0ms
  TuyAPI Connecting to 192.168.2.Z... +6ms
  TuyAPI Socket connected. +72ms
  TuyAPI GET Payload: +1ms
  TuyAPI {
  TuyAPI   gwId: 'XXXXX',
  TuyAPI   devId: 'XXXXX',
  TuyAPI   t: '1595490890',
  TuyAPI   dps: {},
  TuyAPI   uid: 'XXXXX'
  TuyAPI } +0ms
  TuyAPI GET Payload: +12ms
  TuyAPI {
  TuyAPI   gwId: 'XXXXX',
  TuyAPI   devId: 'XXXXX',
  TuyAPI   t: '1595490890',
  TuyAPI   dps: {},
  TuyAPI   uid: 'XXXXX'
  TuyAPI } +0ms
  TuyAPI Received data: 000055aa000000010000000a0000002c000000011fd12f2145a2b4e48d0bc6f78454ef31ce04d93fc98d24d84e47a9045c13e0bd73b5e0ba0000aa55 +6ms
  TuyAPI Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('json obj data unvalid')
  TuyAPI     at TuyaDevice.emit (events.js:304:17)
  TuyAPI     at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:318:22)
  TuyAPI     at Socket.emit (events.js:315:20)
  TuyAPI     at addChunk (_stream_readable.js:295:12)
  TuyAPI     at readableAddChunk (_stream_readable.js:271:9)
  TuyAPI     at Socket.Readable.push (_stream_readable.js:212:10)
  TuyAPI     at TCP.onStreamRead (internal/stream_base_commons.js:186:23) +4ms
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('json obj data unvalid')
    at TuyaDevice.emit (events.js:304:17)
    at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:318:22)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
Emitted 'error' event on TuyaDevice instance at:
    at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:334:18)
    at Socket.emit (events.js:315:20)
    [... lines matching original stack trace ...]
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23) {
  code: 'ERR_UNHANDLED_ERROR',
  context: 'json obj data unvalid'
}

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
t3h-n00bcommented, Jul 31, 2020

Yep, tried using no protocol version, and then iterating from 3.1-3.3.

I’ll try and capture some traffic over the next couple of days

0reactions
bb165sourcecommented, Nov 26, 2020

I seem to getting an error too. Not sure if the error is related:

` TuyAPI Error [ERR_UNHANDLED_ERROR]: Unhandled error. (‘json obj data unvalid’) TuyAPI at TuyaDevice.emit (events.js:303:17) TuyAPI at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:319:22) TuyAPI at Socket.emit (events.js:314:20) TuyAPI at addChunk (_stream_readable.js:298:12) TuyAPI at readableAddChunk (_stream_readable.js:273:9) TuyAPI at Socket.Readable.push (_stream_readable.js:214:10) TuyAPI at TCP.onStreamRead (internal/stream_base_commons.js:188:23) +12ms events.js:291 throw er; // Unhandled ‘error’ event ^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. (‘json obj data unvalid’) at TuyaDevice.emit (events.js:303:17) at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:319:22) at Socket.emit (events.js:314:20) at addChunk (_stream_readable.js:298:12) at readableAddChunk (_stream_readable.js:273:9) at Socket.Readable.push (_stream_readable.js:214:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) Emitted ‘error’ event on TuyaDevice instance at: at Socket.<anonymous> (/usr/lib/node_modules/@tuyapi/cli/node_modules/tuyapi/index.js:335:18) at Socket.emit (events.js:314:20) [… lines matching original stack trace …] at TCP.onStreamRead (internal/stream_base_commons.js:188:23) { code: ‘ERR_UNHANDLED_ERROR’, context: ‘json obj data unvalid’ }`

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parse Error: What It Is and How to Fix It - Lifewire
A parse error is an error message you sometimes get on Android devices when an app fails to install. The message itself is...
Read more >
What is a parse error? - Quora
A parse error in a piece of computer code, also known as a syntax error, prevents your program from compiling. Parse errors happen...
Read more >
6 Methods to Fix Parse Error on Your Android Device - MiniTool
How to Fix Parse Error on Android? · Solution 1: Update Android · Solution 2: Modify Permission on Your Android · Solution 3:...
Read more >
What is Parse? - Computer Hope
To parse data or information means to break it down into component parts so that its syntax can be analyzed, categorized, and understood....
Read more >
SyntaxError: JSON.parse: bad parsing - JavaScript | MDN
JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found