Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 

Parrot/Flower Power connector

About Parrot/Flower Power

Parrot is a company that specializes in technologies involving voice recognition and signal processing for embedded products and drones.

Parrot has also developed the Flower Power, which is a very interesting plant sensor. The Flower Power devices regularly provide data about the plant they are close to, as well as data about their own status, to a companion mobile application. This data is also accessible through public APIs and can be usefully leveraged by smart garden and smart agriculture applications.

Purpose of the scriptr.io connector for Flower Power

The connector simplifies how scriptr.io's developers can leverage Parrot's APIs from within their scripts, by providing a JavaScript object that wraps the APIs, as well as some other useful methods.

Components

  • parrot/flowerpower/client.js: this is the main object to interact with to obtain data on your gardens, plants, devices and users.
  • parrot/flowerpower/config.js: a configuration script
  • parrot/flowerpower/test/tests.js: this file gives examples on how to use the Flower Power connector.

How to use

Step 1

In order to user the connector from within a script, you first need to require the client module:

var flowerPowerModule = require("/modules/parrot/flowerpower/client.js");

Step 2

You then need to create an instance of the FlowerPower class, using one of the following options:

// option 1: you provide your app's credentials and the URL of the Parrot API
var flowerPower = new flowerPowerModule.FlowerPower({
  "username": "galileo@scriptr.io",
  "baseUrl": "https://apiflowerpower.parrot.com",
  "access_id": "edison", // Your Parrot application's access_id (example)
  "access_secret": "WtFxqKvWe9HLuDAYswsSMaHS7fQb7kqHVT2eqr6RZqRtvIAv" // Your Parrot applications' secret (example)
});

// option 2: you have specified your app's credentials and the URL of the Parrot API in the config file
// using the "flowerpowerUrl", "access_id" and "access_secret" variables
 
var flowerPower = new flowerPowerModule.FlowerPower({username:"galileo@scriptr.io"});

Step 3

If you do not already own an authentication for a given user, log that user (you need to obtain his Parrot username and password, from a front-end app for example)

flowerPower.login("galileo@scriptr.io", "SomePassword"); // example

Step 4 Invoke any of the connector's functions. Example:

var locationStatus = flowerPower.getGardenLocationsStatus();
var gardenSensorsBatteryInfo =  flowerPower.getGardenSensorsBatteryInfo();
var userProfile = flowerPower.getUserProfile(); 

Check the list of all available methods in the parrot/flowerpower/test/tests.js script.

About

No description, website, or topics provided.

Resources

License

Releases

No releases published

Packages

No packages published