Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecb, ea, ecPorous are undefined in the modules below #20

Open
Elambaruthi opened this issue Feb 9, 2017 · 5 comments
Open

ecb, ea, ecPorous are undefined in the modules below #20

Elambaruthi opened this issue Feb 9, 2017 · 5 comments

Comments

@Elambaruthi
Copy link

flowerPower.on('calibratedEaChange', callback(ea));
flowerPower.on('calibratedEcbChange', callback(ecb));
flowerPower.on('calibratedEcPorousChange', callback(ecPorous));

Node says ecb, ea, ecPorous are undefined values.
Please help me with this.

@sandeepmistry
Copy link
Owner

@Elambaruthi could you please share some minimum code to reproduce the issue?

What firmware version do you have installed on the device?

@ghost
Copy link

ghost commented Feb 13, 2017

To reproduce, we only have to run test.js: ecb, ea, ecPorous do not return values
Issue #18 is related to this as well.

pi@PlantCare:~/node_modules/flower-power $ node test.js
connectAndSetup
readSystemId
system id = a0:14:3d:00:00:0d:8a:61
readSerialNumber
serial number = PI040307AA4E029422�����
readFirmwareRevision
firmware revision = 2016-09-14_hawaii-2.0.3_hardware-config-MP
readHardwareRevision
hardware revision = 2013-07-26_hawaiiProduction-1.2_protoDV-bootloader
readManufacturerName
manufacturer name = Parrot
readBatteryLevel
battery level = 59
readColor
color = blue
readSunlight
sunlight = 0.13 mol/m²/d
readSoilTemperature
soil temperature = 18.98°C
readAirTemperature
air temperature = 20.70°C
readSoilMoisture
soil moisture = 18.91%
readCalibratedSoilMoisture
calibrated soil moisture = 27.64%
readCalibratedAirTemperature
calibrated air temperature = 21.64°C
readCalibratedSunlight
calibrated sunlight = 0.10 mol/m²/d
readCalibratedEa
/home/pi/node_modules/flower-power/test.js:197
console.log('calibrated EA = ' + ea.toFixed(2));
^

TypeError: Cannot read property 'toFixed' of undefined
at /home/pi/node_modules/flower-power/test.js:197:50
at /home/pi/node_modules/noble-device/lib/noble-device.js:228:14
at FlowerPower.NobleDevice.readDataCharacteristic (/home/pi/node_modules/noble-device/lib/noble-device.js:100:12)
at FlowerPower.NobleDevice.readFloatLECharacteristic (/home/pi/node_modules/noble-device/lib/noble-device.js:226:8)
at FlowerPower.readCalibratedEa (/home/pi/node_modules/flower-power/index.js:313:8)
at /home/pi/node_modules/flower-power/test.js:198:25
at /home/pi/node_modules/async/dist/async.js:3686:9
at replenish (/home/pi/node_modules/async/dist/async.js:882:17)
at iterateeCallback (/home/pi/node_modules/async/dist/async.js:867:17)
at /home/pi/node_modules/async/dist/async.js:840:16

@Elambaruthi
Copy link
Author

it is firmWare "2016-09-14_hawaii-2.0.3" @sandeepmistry

@Elambaruthi
Copy link
Author

router.get('/ea',function(req, res, next){
res.send(global.ea);
res.send(JSON.stringify({
sunlight: global.sunlight}));
});

router.get('/ecb',function(req, res, next){
res.sendStatus(global.ecb);
res.send(JSON.stringify({
sunlight: global.sunlight}));
});

router.get('/ecPorous',function(req, res, next){
myFlowerPower.readCalibratedEcPorous(function(error, ecPorous){
res.send(JSON.stringify({
ecPorous: ecPorous}));
});
});

It happened after the firmware upgrade @sandeepmistry

@sandeepmistry
Copy link
Owner

What's the value of the error argument?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants