ya-lifx

2.1.1 • Public • Published

💡 ya-lifx

REST client for the Lifx's API; each method of ya-lifx return a promise which resolve with the API's response;

Dev dependencies status

Installing

use npm to install the lib on you proyect;

npm install ya-lifx

Usage

You'll need a valid Lifx's token to use the lib; generate it from https://cloud.lifx.com/settings

var lifx = require('ya-lifx');
 
lifx.init('YOUR_TOKEN');
lifx.listLights()
  .then(function(response){
    console.log(response);
    console.log('API Limits ', lifx.apiLimits());
 
  })
  .catch(function(err){
    console.log('Error');
    console.log(err.error);
    console.log(err.warnings);
  });

Available methods

The available methods of the lib are:

  • init: set the Lifx's token
  • listLights: Gets lights belonging to the authenticated account.
  • listScenes: Lists all the scenes available in the users account
  • validateColor: Validate a user's color string and return the hue, saturation brightness and kelvin values that the API will interpret as.
  • setState: Sets the state of the lights within the selector.
  • activateScene: Activates a scene from the users account.
  • toggle: Turn off lights if they are on, or turn them on if they are off.
  • breathe: Performs a breathe effect by slowly fading between the given colors.
  • pulse: Performs a pulse effect by quickly flashing between the given colors.
  • cycle: Make the light(s) cycle to the next or previous state in a list of states.
  • apiRateLimits: Return the Rate limit from the previous call.

Errors and Warnings

Please referer to Errors documentation for more information.

Inspired by pifx

License

MIT

Dependencies (1)

Dev Dependencies (2)

Package Sidebar

Install

npm i ya-lifx

Weekly Downloads

3

Version

2.1.1

License

MIT

Unpacked Size

28.2 kB

Total Files

18

Last publish

Collaborators

  • mdottavio