Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: timeout is not defined #9

Open
andreypopov opened this issue Aug 12, 2019 · 10 comments
Open

ReferenceError: timeout is not defined #9

andreypopov opened this issue Aug 12, 2019 · 10 comments

Comments

@andreypopov
Copy link

(node:63079) UnhandledPromiseRejectionWarning: ReferenceError: timeout is not defined
at TuyaDevice. (/Users/apopov/.node-red/node_modules/node-red-contrib-tuya-local/tuya-local.js:74:17)
at TuyaDevice.emit (events.js:200:13)
at Socket. (/Users/apopov/.node-red/node_modules/node-red-contrib-tuya-local/node_modules/tuyapi/index.js:367:16)
at Socket.emit (events.js:205:15)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1040:10)
(node:63079) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:63079) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@subzero79
Copy link
Owner

Try to update to the latest.

@subzero79
Copy link
Owner

Any luck?

@andreypopov
Copy link
Author

pls. add tag node-red to package.json, update version
hard to install and update right now

@subzero79
Copy link
Owner

The package is not yet published to npm. I’ll sort that out during the week. I need to make sure is working properly. Did you update the node to latest and is it working ?

@andreypopov
Copy link
Author

node-red crashes at start

13 Aug 10:04:26 - [red] Uncaught Exception:
13 Aug 10:04:26 - TypeError: Cannot read property 'replace' of undefined
at filterCommandByte (/Users/apopov/.node-red/node_modules/node-red-contrib-tuya-local/lib/utils.js:48:18)
at TuyaDevice. (/Users/apopov/.node-red/node_modules/node-red-contrib-tuya-local/tuya-local.js:114:16)
at TuyaDevice.emit (events.js:200:13)
at TuyaDevice._packetHandler (/Users/apopov/.node-red/node_modules/node-red-contrib-tuya-local/node_modules/tuyapi/index.js:411:10)
at /Users/apopov/.node-red/node_modules/node-red-contrib-tuya-local/node_modules/tuyapi/index.js:315:43
at Array.forEach ()
at Socket. (/Users/apopov/.node-red/node_modules/node-red-contrib-tuya-local/node_modules/tuyapi/index.js:311:19)
at Socket.emit (events.js:200:13)
at addChunk (_stream_readable.js:294:12)
at readableAddChunk (_stream_readable.js:275:11)

@subzero79
Copy link
Owner

I cannot reproduce this, did just update? are you using the commandByte filter?

@andreypopov
Copy link
Author

2019-08-13_10-10-34

Just add extra check

function filterCommandByte(msg,cmd_bytes) {
	if (!cmd_bytes) return null;
	arr = cmd_bytes.replace(/\s/g,"").split(",");
	arr = arr.map(function (x) { 
  		return parseInt(x, 10); 
	});
	return (arr.includes(msg.commandByte)) ? null : msg;
}

next issue is:

(node:73782) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '1' of undefined
at /Users/apopov/.node-red/node_modules/node-red-contrib-tuya-local/node_modules/tuyapi/index.js:122:29
at processTicksAndRejections (internal/process/task_queues.js:89:5)
(node:73782) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:73782) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@subzero79
Copy link
Owner

The second error is tuyapi, nothing we can do there.

I cannot reproduce the first one, not an expert in this. What node version is this ?

@andreypopov
Copy link
Author

node v12.4.0
node-red v0.20.7

@subzero79
Copy link
Owner

Just tested with v12.4.0 and is working fine. Did you maybe duplicate the node with same ip address?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants