# node-flower-power

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

Latest version **1.1.0** (published 2014-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-flower-power
pnpm add node-flower-power
yarn add node-flower-power
bun add node-flower-power
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2014-07-29 |
| First published | 2014-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ali Karbassi |
| Maintainers | karbassi |
| Keywords | Parrot, Flower Power, Flower Power API |

## Links

- npm: https://www.npmjs.com/package/node-flower-power
- Repository: https://github.com/karbassi/node-flower-power-api
- Issues: https://github.com/karbassi/node-flower-power-api/issues
- npm.io page: https://npm.io/package/node-flower-power

## Dependencies (2)

- [moment](https://npm.io/package/moment.md) ^2.5.1
- [request](https://npm.io/package/request.md) ^2.34.0

## Recent versions

- 1.1.0 (latest) — 2014-07-29
- 1.0.3 — 2014-03-11
- 1.0.2 — 2014-03-11
- 1.0.1 — 2014-03-11
- 1.0.0 — 2014-03-11

## README

node-flower-power
=======================

A node.js module to interface with the [Parrot Flower Power](http://www.parrot.com/flowerpower/) API.

Getting Starting
---------------

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

- Get the OAuth tokens from the [api access form](https://apiflowerpower.parrot.com/api_access/signup).

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);

---
_Source: https://npm.io/package/node-flower-power · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
