Problems reading sensors with BLE-coud-bridge

My garden comprises 8 plants with Flower Power sensors distributed over 2 rooms and one balcony, none of them more than 6 meters from the raspberry pi with BLE stick (BCM20702A0) but of course there are the usual one or two drywalls and in some cases a window in the line of sight.

All node libraries where installed with the recommended versions. All sensors appear in an lescan, the first 5 within a few seconds:

~/src/FlowerPower-Tools/BLE-cloud-bridge $ sudo hcitool lescan LE Scan ... 60:03:08:BD:9A:FB (unknown) 60:03:08:BD:9A:FB (unknown) A0:14:3D:07:CF:D6 (unknown) 90:03:B7:E8:1B:DB (unknown) 90:03:B7:E8:1B:DB Flower power 1BDB A0:14:3D:07:D0:4D (unknown) A0:14:3D:07:D0:4D Flower power D04D 90:03:B7:C7:40:68 (unknown) 90:03:B7:C7:40:68 Flower power 4068 A0:14:3D:07:D4:66 (unknown) A0:14:3D:07:D4:66 Flower power D466 90:03:B7:C7:47:6B (unknown) 90:03:B7:C7:47:6B Flower power 476B A0:14:3D:07:CF:B5 (unknown) A0:14:3D:07:CF:B5 Flower power CFB5 A0:14:3D:07:CF:D6 Flower power CFD6 A0:14:3D:07:CE:5E (unknown)

Running the BLE-cloud-bride app using the, my mileage varies profoundly:

  • Sometimes, readout starts with D04D and D466, which are in direct line of sight to the raspberry pi, w/out obstructions. This works perfectly, all new data is read out fine, the data being pushed to the cloud API without problems.
  • Often, the list of detected sensors comprises only those two, seldom one or more of the other sensors.
  • When one of the other sensors is read out, an error occurs, and the complete readout process stops, dumping a stack trace:
~/src/FlowerPower-Tools/BLE-cloud-bridge $ sh ** login credentials removed ** login error: premature end-of-file login error: invalid credentials: code=undefined results=undefined getGarden: premature end-of-file invoke { event: 'garden_locations_status', diagnostic: 'premature end-of-file' } a0143d07d04d SLICE 9003b7c7476b a0143d07d466 SLICE a0143d07cfd6 SLICE 9003b7e81bdb a0143d07cfb5 SLICE 9003b7c74068 End of discovery connectAndSetup{"uuid":"a0143d07cfb5","name":"Flower power CFB5"} disconnected! readFriendlyName
TypeError: Cannot read property '39e1fe0384a811e2afba0002a5d5c51b' of undefined
    at FlowerPower.NobleDevice.readDataCharacteristic (/home/andy/node_modules/noble-device/lib/noble-device.js:68:37)
    at FlowerPower.NobleDevice.readStringCharacteristic (/home/andy/node_modules/noble-device/lib/noble-device.js:103:8)
    at FlowerPower.readFriendlyName (/home/andy/node_modules/node-flower-power/index.js:96:7)
    at function).getHistoryNbEntries.NbrEntries (/home/andy/src/FlowerPower-Tools/BLE-cloud-bridge/app.js:162:20)
    at /usr/lib/nodejs/async.js:610:21
    at /usr/lib/nodejs/async.js:249:17
    at iterate (/usr/lib/nodejs/async.js:149:13)
    at /usr/lib/nodejs/async.js:160:25
    at /usr/lib/nodejs/async.js:251:21
    at /usr/lib/nodejs/async.js:615:34

I assume this is due to bad reception of the respective sensor. Is there anything that can be done about this, so that the app can proceed with another sensor if one can not be read out properly? I have no experience with javascript yet, so I have no chance of looking into this on my own.

I can see a solution, where 2-3 rasperry pi units collect data from those sensors they can communicate with best, as indicated in the TSRP example of node-flower-power, leaving the rest to the other units. For this to work however, the BLE-cloud-bridge app needs to handle communication rpblems more gracefully.


Hi @gandy92,

There is a new BLE-cloud-bridge module:

If you have a raspberry pi, make sure the version of linux is at least 4.1.7.