npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

seneca-lifx

v0.1.0

Published

A Seneca plugin for controlling LIFX lights

Downloads

3

Readme

seneca-lifx

A plugin for Seneca

This plugin will expose actions to control LIFX lights.

npm version Build Status

Install

Since Seneca and this service are built on top of Node.js you will need to have it installed. To install run the following:

npm install seneca
npm install seneca-lifx

Quick Example

Make sure you have already done the install steps to get the seneca and dependency modules in your working folder.

var seneca = require('seneca')();
seneca.use('seneca-lifx');

function lighton() {
    console.log('Get a list of lights');
    // Send the action to get a list of all lights on the network
    seneca.act({role: 'lifx', cmd: 'lights'}, function(err,result){
        if (err) return console.error(err)
        
        // Get the first light in the list
        var id = result.answer[0].id;
        var name = result.answer[0].name;
        console.log('Turning the ' + name + ' light on');
        
        // Send the action to turn the light on
        seneca.act({role: 'lifx', cmd: 'light_on', id: id}, function(err,result){
            if (err) return console.error(err)
            console.log(result);
            // Give the plugin time to send the command to the light before shutting down the process
            setTimeout(exit, 3000);
        });
    });
}

function exit()
{
    process.exit(1);
}

// Give the plugin time to initialize the communications to the LIFX lights before doing something with the lights.
setTimeout(lighton, 5000);

Actions

ACTION: role:lifx, cmd:lights

Gets a list of all the lights on the network.

ACTION: role:lifx, cmd:light_on, id:d073d511b1fd

Turns on a light.

  • id: This can be the IP, LIFX Unique ID, or the name of the light

ACTION: role:lifx, cmd:light_off, id:d073d511b1fd

Turns off a light.

  • id: This can be the IP, LIFX Unique ID, or the name of the light

ACTION: role:lifx, cmd:color, id:d073d511b1fd

Changes the color of a light.

  • id: This can be the IP, LIFX Unique ID, or the name of the light
  • hue: This is the hue setting of the light (0-360)
  • saturation: This is the saturation setting of the light (0%-100%)
  • brightness: This is the brightness setting of the light (0% - 100%)
  • kelvin: Optional setting for the color temperature (2500 - 9000)
  • duration: Optional setting to fade the color over time to the new setting (milliseconds)

Roadmap

These are a few items I think this module could use to make it more useful. I don't have any plans on when the following will be done or in what order.

  • Track the up/down time of a LIFX bulb
  • Add support for setting the label of a LIFX bulb
  • Add unit tests and enable the Travis CI tests and code coverage