flower-power

node.js lib for the Parrot Flower Power

npm install flower-power
2 downloads in the last day
4 downloads in the last week
9 downloads in the last month

node-flower-power

node.js lib for the Parrot Flower Power

Install

npm install flower-power

Usage

var FlowerPower = require('flower-power');

Discover

FlowerPower.discover(callback(flowerPower));

Connect

flowerPower.connect(callback);

Disconnect

flowerPower.disconnect(callback);

Discover Services and Characteristics

flowerPower.discoverServicesAndCharacteristics(callback);

Device Info

flowerPower.readSystemId(callback(systemId));

flowerPower.readSerialNumber(callback(serialNumber));

flowerPower.readFirmwareRevision(callback(firmwareRevision));

flowerPower.readHardwareRevision(callback(hardwareRevision));

Other Info

flowerPower.readFriendlyName(callback(friendlyName)); 

flowerPower.writeFriendlyName(friendlyName, callback);


flowerPower.readColor(callback(color));

Battery Level

// batteryLevel range is 0 - 100
flowerPower.readBatteryLevel(callback(batteryLevel));

Sunlight

// sunlight units are photons per square meter 
flowerPower.readSunlight(callback(sunlight));

Temperature

flowerPower.readTemperature(callback(temperatureC, temperatureF));

Soil Moisture

// soilMoisture units is percentage (%)
flowerPower.readSoilMoisture(callback(soilMoisture));

Live mode

// sunlightChange, temperatureChange, soilMoistureChange events are emitted (see below)

flowerPower.enableLiveMode(callback);

flowerPower.disableLiveMode(callback);

Events

Disconnect

flowerPower.on('disconnect', callback);

Sunlight Change

flowerPower.on('sunlightChange', callback(sunlight));

Temperature Change

flowerPower.on('temperatureChange', callback(temperatureC, temperatureF));

Soil Moisture Change

flowerPower.on('soilMoistureChange', callback(soilMoisture));

TODO

  • discover
  • connect
  • discover
  • discover services and characteristics
  • read device info
    • system id
    • serial number
    • firmware revision
    • hardware revision
  • read battery level
  • read sunlight
  • read temperature
  • read soil moisture
  • live mode
    • sunlight
    • temperature
    • soil moisture
  • read fertilizer
  • read historic data
    • sunlight
    • temperature
    • soil moisture
    • fertizler
  • use calculations to convert values (currently using lookup table)
npm loves you