You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
15 Nov 10:09:41 - [red] Uncaught Exception:
15 Nov 10:09:41 - [error] TypeError: Cannot read properties of undefined (reading 'payload')
at Socket.<anonymous> (/home/iain/.node-red/node_modules/tuyapi/index.js:985:30)
at Socket.emit (node:events:517:28)
at Socket.emit (node:domain:489:12)
at UDP.onMessage [as onmessage] (node:dgram:942:8)
Payload is indeed undefined. If I hack a console.log(error) into the try/catch on line 1003 I get:
TypeError: Prefix does not match: 0000669900000000000000000013000000ef18e50e3166d903b212dcf474d350b9a60368c20de852a60f097eb08cd2cebfc4be6b061d7fc95d05354ad9b981024152cdce6119eb5df16718edc92aab320bf14af2c184d11c7d1ec1b54de7e21c34830a65e71af2332474f5c280bc4e7962288228df3bc8f71aba9c24739310477bee094becd986db3eb01a5cfc33b25150c8a2e3928443591e5a678aa04021bc8c3a89a2e2868a65c6c81bb28c24e41900f21dff928125dbf50c0a1a3e2ca21c87825d45e13c9911905dae6b039b3d147e228fd660d78829fa481ac5efba580b557653080d8fad6bd094499092f13c8296f3341d333141006fc4d77c611a12306400009966
at MessageParser.parsePacket (/home/iain/.node-red/node_modules/tuyapi/lib/message-parser.js:113:13)
at MessageParser.parseRecursive (/home/iain/.node-red/node_modules/tuyapi/lib/message-parser.js:238:25)
at MessageParser.parse (/home/iain/.node-red/node_modules/tuyapi/lib/message-parser.js:259:17)
at Socket.<anonymous> (/home/iain/.node-red/node_modules/tuyapi/index.js:976:26)
at Socket.emit (node:events:517:28)
at Socket.emit (node:domain:489:12)
at UDP.onMessage [as onmessage] (node:dgram:942:8)
UPDATE:
Suspecting the node-red plugin was using an older version of the API, I have since checked out the latest version of this repo and tested it with my problem bulbs. I see the prefix error above has now been fixed, but I get a further error when I put the problem device details into the Asynchronous example in the readme. Ultimately resulting in the same undefined payload. It looks like this second error needs to be resolved before 'node-red-contrib-tuya-smart-device' updates their dependencies.
// $DEBUG=* node test.js
TuyAPI Received UDP message. +1s
TuyAPI RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 257. Received 261
TuyAPI at boundsError (node:internal/buffer:88:9)
TuyAPI at Uint8Array.readInt32BE (node:internal/buffer:484:5)
TuyAPI at MessageParser.parsePacket (/Users/Iain/tuyatest/node_modules/tuyapi/lib/message-parser.js:216:36)
TuyAPI at MessageParser.parseRecursive (/Users/Iain/tuyatest/node_modules/tuyapi/lib/message-parser.js:280:25)
TuyAPI at MessageParser.parse (/Users/Iain/tuyatest/node_modules/tuyapi/lib/message-parser.js:301:17)
TuyAPI at Socket.<anonymous> (/Users/Iain/tuyatest/node_modules/tuyapi/index.js:1005:26)
TuyAPI at Socket.emit (node:events:519:28)
TuyAPI at UDP.onMessage [as onmessage] (node:dgram:943:8) +1ms
TuyAPI UDP data: +1ms
TuyAPI undefined +0ms
/Users/Iain/tuyatest/node_modules/tuyapi/index.js:1014
const thisID = dataRes.payload.gwId;
^
TypeError: Cannot read properties of undefined (reading 'payload')
at Socket.<anonymous> (/Users/Iain/tuyatest/node_modules/tuyapi/index.js:1014:30)
at Socket.emit (node:events:519:28)
at UDP.onMessage [as onmessage] (node:dgram:943:8)
I'm happy to assist in debugging this. If I can't control these lamps using the Tuya API, I would at least like them to not crash the api and in turn, crash node-red. I need to have the bulbs in the Tuya app to control them. I have tried removing them from the linked App account in the Tuya dashboard, but they continue to appear in the list of devices and crash the API.
Thanks.
The text was updated successfully, but these errors were encountered:
I think I have the same issue as some of the commenters on #325.
I'm using https://flows.nodered.org/node/node-red-contrib-tuya-smart-device in v4.0.5 of node-red on a raspberry pi 4.
Since adding some Antela bulbs to the Tuya app, node red crashes with the below error...
I think some minification might be happening, as I have traced the error to this line: https://github.com/codetheweb/tuyapi/blob/master/index.js#L1013
(which is 985 on my local version. not 1013.)
Payload is indeed undefined. If I hack a
console.log(error)
into the try/catch on line 1003 I get:UPDATE:
Suspecting the node-red plugin was using an older version of the API, I have since checked out the latest version of this repo and tested it with my problem bulbs. I see the prefix error above has now been fixed, but I get a further error when I put the problem device details into the Asynchronous example in the readme. Ultimately resulting in the same undefined payload. It looks like this second error needs to be resolved before 'node-red-contrib-tuya-smart-device' updates their dependencies.
I have run out of talent at this point. https://github.com/codetheweb/tuyapi/blob/master/lib/message-parser.js#L216 😆
I'm happy to assist in debugging this. If I can't control these lamps using the Tuya API, I would at least like them to not crash the api and in turn, crash node-red. I need to have the bulbs in the Tuya app to control them. I have tried removing them from the linked App account in the Tuya dashboard, but they continue to appear in the list of devices and crash the API.
Thanks.
The text was updated successfully, but these errors were encountered: