mangoose002 / Meross2Domoticz

NodeJS bridge between Meross IOT and Domoticz
GNU Lesser General Public License v3.0
5 stars 2 forks source link

Crash After Toogle Or Power Consumption #2

Closed big-ted closed 5 years ago

big-ted commented 5 years ago

MSS310 Firmware - 2.1.9 Hardware - 2.0.0

After a toggle or reading the power consumption

18121193618636221a1034298f13c72a connected 1806290568048239081534298f15aee6 connected Sending state to Meross 18121193618636221a1034298f13c72a data: "Appliance.Control.ToggleX" /home/pi/node_modules/meross-cloud/index.js:252 this.emit('close', error.toString()); ^

TypeError: Cannot read property 'toString' of undefined at MqttClient.client.on (/home/pi/node_modules/meross-cloud/index.js:252:38) at MqttClient.emit (events.js:194:15) at TLSSocket.f (/home/pi/node_modules/once/once.js:25:25) at TLSSocket.onfinish (/home/pi/node_modules/end-of-stream/index.js:30:27) at TLSSocket.emit (events.js:189:13) at finishMaybe (_stream_writable.js:641:14) at stream._final (_stream_writable.js:619:5) at TLSSocket.Socket._final (net.js:353:12) at callFinal (_stream_writable.js:612:10) at process._tickCallback (internal/process/next_tick.js:63:19)

mangoose002 commented 5 years ago

I made change in the code, could you check and tell me. I suspect it comming from the fact that I call ToggleX on MSS310 but it wasn't working for me if I were calling the Toggle method.

big-ted commented 5 years ago

Power consumption is now working, however when I toggle the switch either from Domoticz or the Meross app

Enabled debugging

18121193618636221a1034298f13c72a (Socket 1) connected 1806290568048229081534298f15aee6 (Bedroom Strip) connected { Battery: 255, RSSI: 12, description: '18121193618636221a1034298f13c72a', dtype: 'Lighting 1', id: '67', idx: 914, name: 'Meross Socket 1', nvalue: 0, stype: 'X10', switchType: 'On/Off', unit: 4 } MerossCloudDevice { domain: null, _events: { connected: [ [Function], [Function] ], close: [ [Function], [Function] ], error: [ [Function], [Function] ], reconnect: [ [Function], [Function] ], data: [ [Function], [Function] ], rawData: [Function] }, _eventsCount: 6, _maxListeners: undefined, clientResponseTopic: '/app/148835-f783143c40df168526571a516988cac3/subscribe', waitingMessageIds: {}, token: '3412ee5009fcaa6dcbacd448bb4197f511387f230b1f11d09861f25fec76f1cf', key: '10b926dfd7c7411fe52cd3761136876d', userId: '148835', dev: { uuid: '18121193618636221a1034298f13c72a', onlineStatus: 1, devName: 'Socket 1', devIconId: 'device025', bindTime: 1554560964, deviceType: 'mss310', subType: 'uk', channels: [ {} ], region: 'eu', fmwareVersion: '2.1.9', hdwareVersion: '2.0.0', userDevIcon: '', iconType: 1, skillNumber: '', domain: 'eu-iot.meross.com', reservedDomain: 'eu-smart.meross.com' }, client: MqttClient { options: { protocol: 'mqtts', host: 'eu-iot.meross.com', port: 2001, clientId: 'app:f783143c40df168526571a516988cac3', username: '148835', password: '5b682ee9661cb483fb080e9bce4149d6', rejectUnauthorized: true, keepalive: 30, defaultProtocol: 'mqtts', reschedulePings: true, protocolId: 'MQTT', protocolVersion: 4, reconnectPeriod: 1000, connectTimeout: 30000, clean: true, resubscribe: true }, streamBuilder: [Function: wrapper], outgoingStore: Store { options: [Object], _inflights: Map {} }, incomingStore: Store { options: [Object], _inflights: Map {} }, queueQoSZero: true, _resubscribeTopics: { '/app/148835/subscribe': 0, '/app/148835-f783143c40df168526571a516988cac3/subscribe': 0 }, messageIdToTopic: { '51770': [Array], '51771': [Array] }, pingTimer: ReInterval { _callback: [Function], _args: [], _interval: [Object], reschedule: [Function], clear: [Function], destroy: [Function] }, connected: true, disconnecting: false, queue: [], connackTimer: Timeout { '0': null, _called: false, _idleTimeout: -1, _idlePrev: null, _idleNext: null, _idleStart: 2757, _onTimeout: null, _timerArgs: undefined, _repeat: null, _destroyed: false,

    [Symbol(triggerAsyncId)]: 77 },
 reconnectTimer: null,
 nextId: 51772,
 outgoing: {},
 _events:
  { connect: [Array],
    close: [Array],
    message: [Function],
    error: [Function],
    reconnect: [Function] },
 _eventsCount: 5,
 domain: null,
 _maxListeners: undefined,
 stream:
  TLSSocket {
    _tlsOptions: [Object],
    _secureEstablished: true,
    _securePending: false,
    _newSessionPending: false,
    _controlReleased: true,
    _SNICallback: null,
    servername: false,
    npnProtocol: undefined,
    alpnProtocol: false,
    authorized: true,
    authorizationError: null,
    encrypted: true,
    _events: [Object],
    _eventsCount: 8,
    connecting: false,
    _hadError: false,
    _handle: [Object],
    _parent: null,
    _host: 'eu-iot.meross.com',
    _readableState: [Object],
    readable: true,
    domain: null,
    _maxListeners: 1000,
    _writableState: [Object],
    writable: true,
    allowHalfOpen: false,
    _bytesDispatched: 181,
    _sockname: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: undefined,
    _server: null,
    ssl: [Object],
    _requestCert: true,
    _rejectUnauthorized: true,
    [Symbol(asyncId)]: 84,
    [Symbol(bytesRead)]: 0 },
 reconnecting: false,
 pingResp: true } }

Sending state to Meross 18121193618636221a1034298f13c72a data: "Appliance.Control.ToggleX" /home/pi/node_modules/meross-cloud/index.js:252 this.emit('close', error.toString()); ^

TypeError: Cannot read property 'toString' of undefined at MqttClient.client.on (/home/pi/node_modules/meross-cloud/index.js:252:38) at emitNone (events.js:111:20) at MqttClient.emit (events.js:208:7) at TLSSocket.f (/home/pi/node_modules/once/once.js:25:25) at TLSSocket.onend (/home/pi/node_modules/end-of-stream/index.js:35:27) at emitNone (events.js:111:20) at TLSSocket.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)

mangoose002 commented 5 years ago

Hi,

What version of meross-cloud do you use? I see differences in the MerossCloudDevice that is provided by this library.

P

big-ted commented 5 years ago

1.0.0

mangoose002 commented 5 years ago

I will try to find what causes this but since I cannot reproduce it at home, it may be a little long and difficult.

big-ted commented 5 years ago

OK, it looks like it is an issue with the meross-cloud module

same issue is here with a state of open

https://github.com/Apollon77/meross-cloud/issues/8

mangoose002 commented 5 years ago

I close this issue as it is more a meross-cloud issue than a Meross2Domoticz issue.