Parrot-Developers / node-flower-bridge

[Ble/Cloud bridge] Synchronize your Flower Powers with a raspberry. Now you can take holidays safely.
BSD 3-Clause "New" or "Revised" License
36 stars 21 forks source link

App breaks when connection failed #7

Closed adrianmihalko closed 4 years ago

adrianmihalko commented 8 years ago

I am running node flower bridge (NFB) on rPi and I have 2 Flower Power.

Sometimes the 2nd FP is out of the range, then NFB simply quits.

$ ./bridge display > /home/pi/Scripts/node-flower-bridge/hello.log &

... usual tasks see log above. ... ...connection failed, bridge quits. ...

pi@raspberrypi:~/Scripts/node-flower-bridge $ /home/pi/Scripts/node-flower-bridge/lib/TaskFP.js:148 throw (self.FP.uuid + ': Connection failed'); ^ a0143d7d9338: Connection failed

[1]+ Exit 1 ./bridge display > /home/pi/Scripts/node-flower-bridge/hello.log

pi@raspberrypi:~/Scripts/node-flower-bridge $ cat hello.log

-- Flower Bridge --

✔ Login! [May 02 2016 18:00:19]: New process every 15 minutes [ 'a0143d7d9338', '9003b7e7f052' ]

May 02 2016 18:00:20: a0143d7d9338: Searching [May 02 2016 18:00:50]: a0143d7d9338: Not found [May 02 2016 18:00:52]: a0143d7d9338: Searching [May 02 2016 18:01:22]: a0143d7d9338: Not found [May 02 2016 18:01:24]: a0143d7d9338: Searching May 02 2016 18:01:54: a0143d7d9338: Not found

May 02 2016 18:01:54: 9003b7e7f052: Searching [May 02 2016 18:01:58]: 9003b7e7f052: Found [May 02 2016 18:01:58]: 9003b7e7f052: Connection [May 02 2016 18:02:04]: 9003b7e7f052: Connected [May 02 2016 18:02:06]: 9003b7e7f052: Getting samples [May 02 2016 18:02:07]: 9003b7e7f052: Sending samples May 02 2016 18:02:08: 9003b7e7f052: Updated May 02 2016 18:02:08: 9003b7e7f052: Disconnected

[ 'a0143d7d9338', '9003b7e7f052' ]

May 02 2016 18:15:21: a0143d7d9338: Searching [May 02 2016 18:15:51]: a0143d7d9338: Not found [May 02 2016 18:15:53]: a0143d7d9338: Searching [May 02 2016 18:16:23]: a0143d7d9338: Not found [May 02 2016 18:16:25]: a0143d7d9338: Searching May 02 2016 18:16:55: a0143d7d9338: Not found

May 02 2016 18:16:55: 9003b7e7f052: Searching [May 02 2016 18:16:57]: 9003b7e7f052: Found [May 02 2016 18:16:57]: 9003b7e7f052: Connection [May 02 2016 18:17:01]: 9003b7e7f052: Connected [May 02 2016 18:17:02]: 9003b7e7f052: Getting samples [May 02 2016 18:17:03]: 9003b7e7f052: Sending samples May 02 2016 18:17:04: 9003b7e7f052: Updated May 02 2016 18:17:04: 9003b7e7f052: Disconnected

[ '9003b7e7f052', 'a0143d7d9338' ]

May 02 2016 18:30:21: 9003b7e7f052: Searching [May 02 2016 18:30:22]: 9003b7e7f052: Found [May 02 2016 18:30:22]: 9003b7e7f052: Connection [May 02 2016 18:30:26]: 9003b7e7f052: Connected [May 02 2016 18:30:28]: 9003b7e7f052: Getting samples May 02 2016 18:30:29: 9003b7e7f052: Sending samples May 02 2016 18:30:29: 9003b7e7f052: Updated May 02 2016 18:30:29: 9003b7e7f052: Disconnected

May 02 2016 18:30:29: a0143d7d9338: Searching [May 02 2016 18:30:59]: a0143d7d9338: Not found [May 02 2016 18:31:01]: a0143d7d9338: Searching [May 02 2016 18:31:31]: a0143d7d9338: Not found [May 02 2016 18:31:33]: a0143d7d9338: Searching [May 02 2016 18:31:36]: a0143d7d9338: Found [May 02 2016 18:31:36]: a0143d7d9338: Connection [May 02 2016 18:31:40]: a0143d7d9338: Connected [May 02 2016 18:31:44]: a0143d7d9338: Getting samples [May 02 2016 18:31:47]: a0143d7d9338: Sending samples May 02 2016 18:31:48: a0143d7d9338: Updated May 02 2016 18:31:48: a0143d7d9338: Disconnected

[ '9003b7e7f052', 'a0143d7d9338' ]

May 02 2016 18:45:21: 9003b7e7f052: Searching May 02 2016 18:45:21: 9003b7e7f052: Found May 02 2016 18:45:21: 9003b7e7f052: Connection [May 02 2016 18:45:26]: 9003b7e7f052: Connected [May 02 2016 18:45:27]: 9003b7e7f052: Getting samples May 02 2016 18:45:28: 9003b7e7f052: Sending samples May 02 2016 18:45:28: 9003b7e7f052: Updated May 02 2016 18:45:28: 9003b7e7f052: Disconnected

May 02 2016 18:45:28: a0143d7d9338: Searching [May 02 2016 18:45:58]: a0143d7d9338: Not found [May 02 2016 18:46:00]: a0143d7d9338: Searching [May 02 2016 18:46:10]: a0143d7d9338: Found [May 02 2016 18:46:10]: a0143d7d9338: Connection [May 02 2016 18:47:10]: a0143d7d9338: Connection failed

adrianmihalko commented 8 years ago

Some more log after a few day testing:

pi@raspberrypi:~/Scripts/node-flower-bridge $ ./bridge display

-- Flower Bridge --

✔ Login! [May 04 2016 17:05:53]: New process every 15 minutes [ '9003b7e7f052', 'a0143d7d9338' ]

May 04 2016 17:05:54: 9003b7e7f052: Searching [May 04 2016 17:05:56]: 9003b7e7f052: Found [May 04 2016 17:05:56]: 9003b7e7f052: Connection /home/pi/Scripts/node-flower-bridge/node_modules/flower-power-ble/node_modules/noble-device/node_modules/noble/lib/hci-socket/smp.js:22 this._ia = new Buffer(localAddress.split(':').reverse().join(''), 'hex'); ^

TypeError: Cannot read property 'split' of undefined at new Smp (/home/pi/Scripts/node-flower-bridge/node_modules/flower-power-ble/node_modules/noble-device/node_modules/noble/lib/hci-socket/smp.js:22:37) at new AclStream (/home/pi/Scripts/node-flower-bridge/node_modules/flower-power-ble/node_modules/noble-device/node_modules/noble/lib/hci-socket/acl-stream.js:12:15) at NobleBindings.onLeConnComplete (/home/pi/Scripts/node-flower-bridge/node_modules/flower-power-ble/node_modules/noble-device/node_modules/noble/lib/hci-socket/bindings.js:172:21) at emitMany (events.js:108:13) at emit (events.js:182:7) at Hci.processLeConnComplete (/home/pi/Scripts/node-flower-bridge/node_modules/flower-power-ble/node_modules/noble-device/node_modules/noble/lib/hci-socket/hci.js:559:8) at Hci.processLeMetaEvent (/home/pi/Scripts/node-flower-bridge/node_modules/flower-power-ble/node_modules/noble-device/node_modules/noble/lib/hci-socket/hci.js:532:10) at Hci.onSocketData (/home/pi/Scripts/node-flower-bridge/node_modules/flower-power-ble/node_modules/noble-device/node_modules/noble/lib/hci-socket/hci.js:429:12) at emitOne (events.js:77:13) at BluetoothHciSocket.emit (events.js:169:7) pi@raspberrypi:~/Scripts/node-flower-bridge $

It also reseted my FlowerPower device, the iOS app says that: your plant is currently being monitored by FP. Diagnosis in X hours.

Great.