Closed bm480 closed 6 years ago
I found one source of the problem and was able to circumvent it by replacing the line with:
var socketID = (currentLine.split(':')[1] || '').trim();
While this prevents the crash from happening, I'm not sure what impact this has on the functioning of the app. At least I was able to try this app further.
After applying the above patch, the app crashed again after adding certain devices. What I noticed is that some devices have null as the value for the alarm_tamper characteristic and alarm_battery:
Realtime event from: ELI Multisensor. Value: {"alarm_motion":false,"measure_temperature":21.2,"measure_luminance":154,"measure_battery":null,"alarm_tamper":null,"alarm_battery":null}
While others have true or false as a value:
Realtime event from: OVL Multisensor. Value: {"alarm_motion":true,"alarm_tamper":false,"measure_temperature":21.1,"measure_luminance":476,"measure_battery":48}
Not sure why this happens, but I was able to prevent crashing of the app by changing line 82 of motion sensor.js with:
var tamper = HAS.predefined.StatusTampered(10, 0);
I think this is related to issue #29
Should be fixed as well.
I have about 40 devices which I added to Homekit 10 devices at a time. When adding the last 10 Homekit doesn't respond on my iPhone anymore and when looking into Homey the HomeyKit app seemed to have crashed. When restarting the HomeyKit app, it crashes directly after initialization has been completed. Same behaviour has been seen in stable version 1.0.13 of the app.
This is the stack trace:
/node_modules/has-node/src/TCP.js:178 var socketID = (currentLine.split(':')[1]).trim(); ^
TypeError: Cannot read property 'trim' of undefined at Socket. (/node_modules/has-node/src/TCP.js:178:55)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:266:12)
at readableAddChunk (_stream_readable.js:253:11)
at Socket.Readable.push (_stream_readable.js:211:10)
at TCP.onread (net.js:585:20)