New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

node-flower-power

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-flower-power

A node.js module to hook into the Parrot Flower Power API

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

node-flower-power

A node.js module to interface with the Parrot Flower Power API.

Getting Starting

  • Make sure you have a Flower Power account and device set up.

  • Get the OAuth tokens from the api access form.

Install

npm install node-flower-power

Example #1

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

var auth = {
  username: '',
  password: '',
  client_id: '',
  client_secret: '',
};

var api = new FlowerPower(auth, function(err, data) {
  if(err) {
    console.log('Error:', err);
  } else {
    console.log('Logged in');
  }
});

// Method #1
api.getGarden(function(err, plants, sensors) {
  if(err) {
    throw "Error";
  }

  plants.forEach(function(plant) {

    api.getSamples({id: plant.location_identifier}, function(err, samples, events, fertilizer) {

      if(err) {
        throw "Error";
      }

      console.log('samples', samples.length);
      console.log('events', events.length);
      console.log('fertilizer', fertilizer.length);
    });

  });
});

Example #2

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

var auth = {
  username: '',
  password: '',
  client_id: '',
  client_secret: '',
};

var api = new FlowerPower(auth);

// Method #2
var getGarden = function() {
  api.getGarden();
};

var getSamples = function(err, plants, sensors) {
  plants.forEach(function(plant) {
    api.getSamples({id: plant.location_identifier});
  });
};

var getSample = function(err, samples, events, fertilizer) {
  console.log('samples', samples.length);
  console.log('events', events.length);
  console.log('fertilizer', fertilizer.length);
};

api.on('authenticated', getGarden);
api.on('have-garden', getSamples);
api.on('have-sample', getSample);

Keywords

Parrot

FAQs

Package last updated on 29 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts