Giter Site home page Giter Site logo

jnv / node-red-contrib-lifx Goto Github PK

View Code? Open in Web Editor NEW
4.0 5.0 5.0 9 KB

[DEPRECATED] LIFX light bulbs control for Node-RED

Home Page: https://www.npmjs.org/package/node-red-contrib-lifx

License: MIT License

JavaScript 38.88% HTML 61.12%
node-red light-bulbs lifx deprecated

node-red-contrib-lifx's Introduction

LIFX control node for Node-RED

published at npm

With this node you can control LIFX light bulbs using Node-RED. The module is mostly a wrapper for unofficial (but great) lifxjs library.

Deprecated

This repository is not maintained anymore, but it lives on in node-red-contrib-lifx2 by Diego Pamio.

Firmware Compatibility

This node depends on lifxjs library version 0.2.1, which should be compatible with the latest versions of LIFX firmware (1.5 was tested).

If you use older versions of firmware (probably before 1.2), use version 0.2.x of this package or v0.2 branch.

Installation

You can install latest release from npm. In your Node-RED directory run:

npm install node-red-contrib-lifx

Alternatively you can clone repository into nodes/ directory and install npm dependencies manually:

cd path/to/node-red/
cd nodes
git clone https://github.com/jnv/node-red-contrib-lifx
cd node-red-contrib-lifx
npm install

Once you restart Node-RED server, there should be a lifx node available in the nodes palette under output category.

output > lifx

Usage

On every received message node sends commands to all LIFX light bulbs.

Initial configuration can be set through node's configuration options, including debug mode for underlying lifxjs library, which dumps network communication. Node will send initial configuration to light bulbs each time the graph is deployed.

lifx node configuration example

Parameters

Both initial configuration and message works with the following parameters, which are passed to lifxjs library:

  • on (bool) – whether the light should be on, or off; true by default
  • hue (uint16) – primary color of light; 0xCC15 by default
  • saturation (uint16) – “how much of color” to use, generally 0x0000 for white and 0xFFFF for full color; 0xFFFF by default
  • luminance (uint16) – light intensity; 0x8000 by default
  • whiteColor (uint16) – color temperature (?); 0x0000 by default
  • fadeTime (uint32) – how quickly the new state should be changed, 0 causes an immediate change, maximum is 0xFFFFFFFF; 0x0513 by default

Numbers can be passed as strings too.

Input

Node expects a message with the following structure:

{
    payload: {
        on: true,
        hue: 0xCC15,
        // etc…
    }
}

msg.payload is an object with none, some, or all parameters. Input parameters are stored and merged with previously passed parameters (or defaults) and then sent to light bulbs.

Therefore you can change only one parameter in the payload and the rest will be remembered and resent.

Output

On received message node sends a payload with its current stored state. E.g.:

{
    payload: {
        on: true,
        hue: '0xCC15',
        saturation: '0xFFFF',
        luminance: '0x8000',
        whiteColor: '',
        fadeTime: '0x0513'
    }
}

TODO

  • Expose more LIFX functions as standalone nodes (e.g. waveform, relative and absolute dim)
  • Allow targeting of individual bulbs instead of the whole mesh (i.e. through configuration node?)
  • Connection sharing for multiple nodes (especially on close; there'll probably have to be a global connection singleton)

See also

  • lifx-alert (Node-RED) lets you set red, green or orange color.
  • hue (Node-RED) for Phillips Hue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.