Skip to content

Pierre-Michard/node-flower-power

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-flower-power

Analytics

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)

About

node.js lib for the Parrot Flower Power

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%