Hi All,
I have previously setup Openhab to work with Tuya devices via MQTT. For some reason it has simply stopped working and it seems the devices are no longer connecting to the broker. My debug file is below: (I have changed the key in the output below)
Any thoughts or sugegstions would be appreciated.
openhabian@openhabian:/opt/tuya-mqtt $ DEBUG=* node tuya-mqtt.js
mqttjs connecting to an MQTT broker… +0ms
mqttjs:client MqttClient :: options.protocol mqtt +0ms
mqttjs:client MqttClient :: options.protocolVersion 4 +1ms
mqttjs:client MqttClient :: options.username +4ms
mqttjs:client MqttClient :: options.keepalive 60 +1ms
mqttjs:client MqttClient :: options.reconnectPeriod 1000 +0ms
mqttjs:client MqttClient :: options.rejectUnauthorized undefined +1ms
mqttjs:client MqttClient :: options.topicAliasMaximum undefined +1ms
mqttjs:client MqttClient :: clientId mqttjs_d25a2f0a +1ms
mqttjs:client MqttClient :: setting up stream +3ms
mqtt-packet:parser _resetState: resetting packet, error, _list, and _stateCounter +0ms
mqttjs:client _setupStream :: calling method to clear reconnect +10ms
mqttjs:client _clearReconnect : clearing reconnect timer +1ms
mqttjs:client _setupStream :: using streamBuilder provided to client to create stream +0ms
mqttjs calling streambuilder for mqtt +37ms
mqttjs:tcp port 1883 and host 192.168.0.3 +0ms
mqttjs:client _setupStream :: pipe stream to writable stream +10ms
mqttjs:client _setupStream: sending packet connect
+7ms
mqttjs:client sendPacket :: packet: { cmd: ‘connect’ } +1ms
mqttjs:client sendPacket :: emitting packetsend
+14ms
mqttjs:client sendPacket :: writing to stream +0ms
mqtt-packet:writeToStream generate called +0ms
mqtt-packet:writeToStream generate: packet.cmd: connect +350ms
mqtt-packet:writeToStream writeVarByteInt: writing to stream: <Buffer 1f> +5ms
mqtt-packet:writeToStream writeNumberCached: number: 4 +5ms
mqtt-packet:writeToStream writeNumberCached: <Buffer 00 04> +1ms
mqtt-packet:writeToStream writeString: MQTT +1ms
mqtt-packet:writeToStream writeNumberCached: number: 60 +0ms
mqtt-packet:writeToStream writeNumberCached: <Buffer 00 3c> +1ms
mqtt-packet:writeToStream writeNumberCached: number: 15 +1ms
mqtt-packet:writeToStream writeNumberCached: <Buffer 00 0f> +0ms
mqtt-packet:writeToStream writeString: mqttjs_d25a2f0a +1ms
mqtt-packet:writeToStream writeNumberCached: number: 0 +1ms
mqtt-packet:writeToStream writeNumberCached: <Buffer 00 00> +0ms
mqtt-packet:writeToStream writeString: +1ms
mqtt-packet:writeToStream writeNumberCached: number: 0 +0ms
mqtt-packet:writeToStream writeNumberCached: <Buffer 00 00> +1ms
mqtt-packet:writeToStream writeString: +1ms
mqttjs:client sendPacket :: writeToStream result true +371ms
mqttjs:client writable stream :: parsing buffer +34ms
mqtt-packet:parser parse: current state: _parseHeader +446ms
mqtt-packet:parser _parseHeader: packet: Packet { cmd: ‘connack’, retain: false, qos: 0, dup: false, length: -1, topic: null, payload: null } +4ms
mqtt-packet:parser parse: state complete. _stateCounter is now: 1 +5ms
mqtt-packet:parser parse: packet.length: -1, buffer list length: 3 +0ms
mqtt-packet:parser _parseVarByteNum +2ms
mqtt-packet:parser _parseVarByteNum: result: { bytes: 1, value: 2 } +1ms
mqtt-packet:parser _parseLength 2 +1ms
mqtt-packet:parser parse: state complete. _stateCounter is now: 2 +1ms
mqtt-packet:parser parse: packet.length: 2, buffer list length: 2 +0ms
mqtt-packet:parser _parsePayload: payload BufferListStream {
mqtt-packet:parser _bufs: [ <Buffer 00 00> ],
mqtt-packet:parser length: 2,
mqtt-packet:parser _readableState: ReadableState {
mqtt-packet:parser objectMode: false,
mqtt-packet:parser highWaterMark: 16384,
mqtt-packet:parser buffer: BufferList { head: null, tail: null, length: 0 },
mqtt-packet:parser length: 0,
mqtt-packet:parser pipes: null,
mqtt-packet:parser pipesCount: 0,
mqtt-packet:parser flowing: null,
mqtt-packet:parser ended: false,
mqtt-packet:parser endEmitted: false,
mqtt-packet:parser reading: false,
mqtt-packet:parser sync: true,
mqtt-packet:parser needReadable: false,
mqtt-packet:parser emittedReadable: false,
mqtt-packet:parser readableListening: false,
mqtt-packet:parser resumeScheduled: false,
mqtt-packet:parser paused: true,
mqtt-packet:parser emitClose: true,
mqtt-packet:parser autoDestroy: false,
mqtt-packet:parser destroyed: false,
mqtt-packet:parser defaultEncoding: ‘utf8’,
mqtt-packet:parser awaitDrain: 0,
mqtt-packet:parser readingMore: false,
mqtt-packet:parser decoder: null,
mqtt-packet:parser encoding: null
mqtt-packet:parser },
mqtt-packet:parser readable: true,
mqtt-packet:parser _events: [Object: null prototype] {},
mqtt-packet:parser _eventsCount: 0,
mqtt-packet:parser _maxListeners: undefined,
mqtt-packet:parser _writableState: WritableState {
mqtt-packet:parser objectMode: false,
mqtt-packet:parser highWaterMark: 16384,
mqtt-packet:parser finalCalled: false,
mqtt-packet:parser needDrain: false,
mqtt-packet:parser ending: false,
mqtt-packet:parser ended: false,
mqtt-packet:parser finished: false,
mqtt-packet:parser destroyed: false,
mqtt-packet:parser decodeStrings: true,
mqtt-packet:parser defaultEncoding: ‘utf8’,
mqtt-packet:parser length: 0,
mqtt-packet:parser writing: false,
mqtt-packet:parser corked: 0,
mqtt-packet:parser sync: true,
mqtt-packet:parser bufferProcessing: false,
mqtt-packet:parser onwrite: [Function (anonymous)],
mqtt-packet:parser writecb: null,
mqtt-packet:parser writelen: 0,
mqtt-packet:parser bufferedRequest: null,
mqtt-packet:parser lastBufferedRequest: null,
mqtt-packet:parser pendingcb: 0,
mqtt-packet:parser prefinished: false,
mqtt-packet:parser errorEmitted: false,
mqtt-packet:parser emitClose: true,
mqtt-packet:parser autoDestroy: false,
mqtt-packet:parser bufferedRequestCount: 0,
mqtt-packet:parser corkedRequestsFree: CorkedRequest {
mqtt-packet:parser next: null,
mqtt-packet:parser entry: null,
mqtt-packet:parser finish: [Function (anonymous)]
mqtt-packet:parser }
mqtt-packet:parser },
mqtt-packet:parser writable: true,
mqtt-packet:parser allowHalfOpen: true,
mqtt-packet:parser [Symbol(kCapture)]: false
mqtt-packet:parser } +2ms
mqtt-packet:parser _parseConnack +24ms
mqtt-packet:parser _parseConnack: complete +1ms
mqtt-packet:parser _parsePayload complete result: true +0ms
mqtt-packet:parser parse: state complete. _stateCounter is now: 3 +1ms
mqtt-packet:parser parse: packet.length: 2, buffer list length: 2 +0ms
mqtt-packet:parser _newPacket +1ms
mqtt-packet:parser _newPacket: parser emit packet: packet.cmd: connack, packet.payload: null, packet.length: 2 +1ms
mqttjs:client parser :: on packet push to packets array. +48ms
mqtt-packet:parser _newPacket: new packet +1ms
mqtt-packet:parser parse: state complete. _stateCounter is now: 4 +1ms
mqtt-packet:parser parse: packet.length: -1, buffer list length: 0 +0ms
mqtt-packet:parser parse: exited while loop. packet: -1, buffer list length: 0 +1ms
mqttjs:client work :: getting next packet in queue +3ms
mqttjs:client work :: packet pulled from queue +1ms
mqttjs:client _handlePacket :: emitting packetreceive +1ms
mqttjs:client _handleConnack +1ms
mqttjs:client _setupPingTimer :: keepalive 60 (seconds) +4ms
mqttjs:client connect :: sending queued packets +16ms
mqttjs:client deliver :: entry undefined +1ms
mqttjs:client _resubscribe +2ms
tuya-mqtt:info Connection established to MQTT server +0ms
mqttjs:client subscribe: array topic tuya/# +5ms
mqttjs:client subscribe: pushing topic tuya/#
and qos 0
to subs list +1ms
mqttjs:client subscribe :: resubscribe true +2ms
mqttjs:client subscribe :: call _sendPacket +1ms
mqttjs:client _sendPacket :: (mqttjs_d25a2f0a) :: start +2ms
mqttjs:client sendPacket :: packet: {
mqttjs:client cmd: ‘subscribe’,
mqttjs:client subscriptions: [ { topic: ‘tuya/#’, qos: 0 } ],
mqttjs:client qos: 1,
mqttjs:client retain: false,
mqttjs:client dup: false,
mqttjs:client messageId: 51428
mqttjs:client } +2ms
mqttjs:client sendPacket :: emitting packetsend
+3ms
mqttjs:client sendPacket :: writing to stream +1ms
mqtt-packet:writeToStream generate called +128ms
mqtt-packet:writeToStream generate: packet.cmd: subscribe +0ms
mqtt-packet:writeToStream subscribe: packet: +3ms
mqtt-packet:writeToStream subscribe: writing to stream: [ [ [ <Buffer 80>, <Buffer 81> ], [ <Buffer 88>, <Buffer 89> ] ], [ [ <Buffer 82>, <Buffer 83> ], [ <Buffer 8a>, <Buffer 8b> ] ], [ [ <Buffer 84>, <Buffer 85> ], [ <Buffer 8c>, <Buffer 8d> ] ] ] +1ms
mqtt-packet:writeToStream writeVarByteInt: writing to stream: <Buffer 0b> +6ms
mqtt-packet:writeToStream writeNumberCached: number: 51428 +1ms
mqtt-packet:writeToStream writeNumberCached: +0ms
mqtt-packet:writeToStream writeNumberCached: number: 6 +1ms
mqtt-packet:writeToStream writeNumberCached: <Buffer 00 06> +0ms
mqtt-packet:writeToStream writeString: tuya/# +1ms
mqttjs:client sendPacket :: writeToStream result true +14ms
mqttjs:client sendPacket :: invoking cb +0ms
mqttjs:client nop :: undefined +1ms
mqttjs:client subscribe: array topic homeassistant/status +1ms
mqttjs:client subscribe: pushing topic homeassistant/status
and qos 0
to subs list +0ms
mqttjs:client subscribe :: resubscribe true +1ms
mqttjs:client subscribe :: call _sendPacket +0ms
mqttjs:client _sendPacket :: (mqttjs_d25a2f0a) :: start +1ms
mqttjs:client sendPacket :: packet: {
mqttjs:client cmd: ‘subscribe’,
mqttjs:client subscriptions: [ { topic: ‘homeassistant/status’, qos: 0 } ],
mqttjs:client qos: 1,
mqttjs:client retain: false,
mqttjs:client dup: false,
mqttjs:client messageId: 51429
mqttjs:client } +1ms
mqttjs:client sendPacket :: emitting packetsend
+2ms
mqttjs:client sendPacket :: writing to stream +0ms
mqtt-packet:writeToStream generate called +9ms
mqtt-packet:writeToStream generate: packet.cmd: subscribe +0ms
mqtt-packet:writeToStream subscribe: packet: +1ms
mqtt-packet:writeToStream subscribe: writing to stream: [ [ [ <Buffer 80>, <Buffer 81> ], [ <Buffer 88>, <Buffer 89> ] ], [ [ <Buffer 82>, <Buffer 83> ], [ <Buffer 8a>, <Buffer 8b> ] ], [ [ <Buffer 84>, <Buffer 85> ], [ <Buffer 8c>, <Buffer 8d> ] ] ] +0ms
mqtt-packet:writeToStream writeVarByteInt: writing to stream: <Buffer 19> +4ms
mqtt-packet:writeToStream writeNumberCached: number: 51429 +1ms
mqtt-packet:writeToStream writeNumberCached: +0ms
mqtt-packet:writeToStream writeNumberCached: number: 20 +1ms
mqtt-packet:writeToStream writeNumberCached: <Buffer 00 14> +0ms
mqtt-packet:writeToStream writeString: homeassistant/status +1ms
mqttjs:client sendPacket :: writeToStream result true +10ms
mqttjs:client sendPacket :: invoking cb +0ms
mqttjs:client nop :: undefined +1ms
mqttjs:client subscribe: array topic hass/status +2ms
mqttjs:client subscribe: pushing topic hass/status
and qos 0
to subs list +1ms
mqttjs:client subscribe :: resubscribe true +1ms
mqttjs:client subscribe :: call _sendPacket +0ms
mqttjs:client _sendPacket :: (mqttjs_d25a2f0a) :: start +0ms
mqttjs:client sendPacket :: packet: {
mqttjs:client cmd: ‘subscribe’,
mqttjs:client subscriptions: [ { topic: ‘hass/status’, qos: 0 } ],
mqttjs:client qos: 1,
mqttjs:client retain: false,
mqttjs:client dup: false,
mqttjs:client messageId: 51430
mqttjs:client } +1ms
mqttjs:client sendPacket :: emitting packetsend
+1ms
mqttjs:client sendPacket :: writing to stream +1ms
mqtt-packet:writeToStream generate called +9ms
mqtt-packet:writeToStream generate: packet.cmd: subscribe +0ms
mqtt-packet:writeToStream subscribe: packet: +0ms
mqtt-packet:writeToStream subscribe: writing to stream: [ [ [ <Buffer 80>, <Buffer 81> ], [ <Buffer 88>, <Buffer 89> ] ], [ [ <Buffer 82>, <Buffer 83> ], [ <Buffer 8a>, <Buffer 8b> ] ], [ [ <Buffer 84>, <Buffer 85> ], [ <Buffer 8c>, <Buffer 8d> ] ] ] +1ms
mqtt-packet:writeToStream writeVarByteInt: writing to stream: <Buffer 10> +2ms
mqtt-packet:writeToStream writeNumberCached: number: 51430 +0ms
mqtt-packet:writeToStream writeNumberCached: +1ms
mqtt-packet:writeToStream writeNumberCached: number: 11 +0ms
mqtt-packet:writeToStream writeNumberCached: <Buffer 00 0b> +0ms
mqtt-packet:writeToStream writeString: hass/status +1ms
mqttjs:client sendPacket :: writeToStream result true +5ms
mqttjs:client sendPacket :: invoking cb +1ms
mqttjs:client nop :: undefined +0ms
tuya-mqtt:tuyapi Search for device id ################# +0ms
TuyAPI Finding missing IP undefined or ID ################## +0ms
tuya-mqtt:tuyapi Search for device id ############### +16ms
tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6666 +0ms
tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms
tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6666 +1ms
tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms
tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6666 +1ms
tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms
tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6666 +5ms
tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms
tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6666 +1ms
tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms
tuya-mqtt:error bind EADDRINUSE 0.0.0.0:6666 +0ms
tuya-mqtt:error Will attempt to find device again in 60 seconds +0ms