michbeck100 / pimatic-hap

Pimatic homekit bridge
GNU General Public License v2.0
30 stars 10 forks source link

v0.2.0 crash with contact #3

Closed Yves911 closed 8 years ago

Yves911 commented 8 years ago

v0.2.0 issue with contact. When a contact is triggered pimatic crash with the following error message.

08:29:08.759 [pimatic-hap] debug: contact sensor state changed. Notifying iOS devices.
08:29:09.422 [pimatic] error: A uncaught exception occured: ReferenceError: getHomekitState is not defined
08:29:09.422 [pimatic] error:>    at HomeduinoRFContactSensor.<anonymous> (/root/pimatic-git/node_modules/pimatic-hap/hap.coffee:264:65)
08:29:09.422 [pimatic] error:>    at HomeduinoRFContactSensor.EventEmitter.emit (events.js:117:20)
08:29:09.422 [pimatic] error:>    at HomeduinoRFContactSensor.ContactSensor._setContact (/root/pimatic-git/node_modules/pimatic/lib/devices.coffee:428:8)
08:29:09.422 [pimatic] error:>    at Board.<anonymous> (/root/pimatic-git/node_modules/pimatic-homeduino/homeduino.coffee:520:14)
08:29:09.422 [pimatic] error:>    at Board.EventEmitter.emit (events.js:117:20)
08:29:09.422 [pimatic] error:>    at Board._emitReceive (/root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/lib/board.js:352:12)
08:29:09.422 [pimatic] error:>    at Board._handleRFControl (/root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/lib/board.js:337:10)
08:29:09.422 [pimatic] error:>    at Board._onLine (/root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/lib/board.js:142:21)
08:29:09.422 [pimatic] error:>    at SerialPortDriver.<anonymous> (/root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/lib/board.js:83:22)
08:29:09.422 [pimatic] error:>    at SerialPortDriver.EventEmitter.emit (events.js:95:17)
08:29:09.422 [pimatic] error:>    at SerialPort.<anonymous> (/root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/lib/driver/serialport.js:60:24)
08:29:09.422 [pimatic] error:>    at SerialPort.EventEmitter.emit (events.js:95:17)
08:29:09.422 [pimatic] error:>    at /root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/parsers.js:25:17
08:29:09.422 [pimatic] error:>    at Array.forEach (native)
08:29:09.422 [pimatic] error:>    at Object.parser (/root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/parsers.js:24:13)
08:29:09.422 [pimatic] error:>    at Object.SerialPort.options.dataCallback (/root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/serialport.js:168:15)
08:29:09.422 [pimatic] error:>    at SerialPortFactory.SerialPort._emitData (/root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/serialport.js:350:20)
08:29:09.422 [pimatic] error:>    at afterRead (/root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/serialport.js:326:20)
08:29:09.422 [pimatic] error:>    at /root/pimatic-git/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules/serialport/serialport.js:342:9
08:29:09.422 [pimatic] error:>    at Object.wrapper [as oncomplete] (fs.js:454:17)
08:29:09.422 [pimatic] error:> This is most probably a bug in pimatic or in a module, please report it!
08:29:09.428 [pimatic] warn: Keeping pimatic alive, but could be in an undefined state, please restart pimatic so soon as possible!
michbeck100 commented 8 years ago

https://github.com/michbeck100/pimatic-hap/commit/a41030ee8fc5a7b9b57b4be4825560be3bf4875f should fix this

Yves911 commented 8 years ago

I confirm this issue is solved, no crash anymore. Btw, when a contact is "closed" in pimatic, Eve reports "Yes" when a contact is "opened" in pimatic, Eve reports "No" i find this a bit strange...

michbeck100 commented 8 years ago

I wasn't sure what the "default" state of a contact sensor might be. As I didn't have a device to test I couldn't test it with eve. I will switch the output if that makes more sense.

michbeck100 commented 8 years ago

After testing the contact sensor, i would say if eve says the contact value is "yes" then this means the sensor has contact, which in turn means that it is closed. I would say this behavior is correct.

Yves911 commented 8 years ago

make sense, thanks