sandeepmistry / node-flower-power

node.js lib for the Parrot Flower Power
MIT License
45 stars 32 forks source link

TypeError: Cannot call method 'read' of undefined #7

Closed iphilhappy closed 9 years ago

iphilhappy commented 9 years ago

Hello,

I have tried to use the software with the following usb dongle: 1 Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) 2 Bus 001 Device 003: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0

The first one is hanging completely and the second one is having a software problem:

p@debian8:~/dev/node_modules/flower-power$ sudo node test.js connectAndSetup readSystemId system id = 90:03:b7:00:00:e7:e2:16 readSerialNumber serial number = PI040298AA3K027231��Flower p readFirmwareRevision firmware revision = 2013-09-05_hawaii-1.0.0_hardware-config-MP readHardwareRevision hardware revision = 2013-07-26_hawaiiProduction-1.2_protoDV-bootloader readManufacturerName manufacturer name = Parrot readBatteryLevel battery level = 100 readFriendlyName friendly name = Flower power E216 writeFriendlyName readColor color = green readSunlight sunlight = 0.13 mol/m²/d readSoilElectricalConductivity soil electrical conductivity = 0.00 readSoilTemperature soil temperature = 20.51°C readAirTemperature air temperature = 20.61°C readSoilMoisture soil moisture = 0.00% readCalibratedSoilMoisture

/home/p/dev/node_modules/flower-power/node_modules/noble-device/lib/noble-device.js:68 this._characteristics[serviceUuid][characteristicUuid].read(function(error, ^ TypeError: Cannot call method 'read' of undefined at FlowerPower.NobleDevice.readDataCharacteristic (/home/p/dev/node_modules/flower-power/node_modules/noble-device/lib/noble-device.js:68:58) at FlowerPower.NobleDevice.readFloatLECharacteristic (/home/p/dev/node_modules/flower-power/node_modules/noble-device/lib/noble-device.js:112:8) at FlowerPower.readCalibratedSoilMoisture (/home/p/dev/node_modules/flower-power/index.js:243:8) at /home/p/dev/node_modules/flower-power/test.js:162:19 at /home/p/dev/node_modules/async/lib/async.js:610:21 at /home/p/dev/node_modules/async/lib/async.js:249:17 at iterate (/home/p/dev/node_modules/async/lib/async.js:149:13) at /home/p/dev/node_modules/async/lib/async.js:160:25 at /home/p/dev/node_modules/async/lib/async.js:251:21

Your help is welcome, Philippe

sandeepmistry commented 9 years ago

@iphilhappy test.js expects version 1.1 of the firmware, so it can read the new calibrated data features, you are running 1.0 (2013-09-05_hawaii-1.0.0_hardware-config-MP).

If possible, update your firmware to 1.1 via the Parrot Flower Power app. I'll make a change to test.js to auto detect version and not call API's that only work with 1.1. The other option for you is to remove the calls to all calibrated API calls or create your own app in the meant time ...

sandeepmistry commented 9 years ago

@iphilhappy https://github.com/sandeepmistry/node-flower-power/commit/d22c6a1d386c8e3407f1fcc90c7359fa208c4750 should address older firmware compatibility with test.js