Skip to content

jshea2/NodeLifxOSC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeLifxOSC

Uses Node.js to Convert OSC Commands into RGB Values for LIFX API

Requires:

Example Video using Art-Net from Qlab to Node.js relaying commands to LIFX API:

NodeLifxOSC DEMO

NEW Features in version 1.1.0

  • Added OSC command to control Kelvin Temperature

LIFX Setup:

  • Add all LIFX Lightbulbs to 1 Account
  • This also works in Multiple Locations on Different WiFi Networks

OSC Software Setup:

  • Set OSC Software to match the 'main.js' file or vice versa

    'main.js' is defaulted to: IP: 127.0.0.1, Port: 3333

OSC Commands:

String: Argument 1:
String, Kelvin, or Red Value
Argument 2:
Green Value
Argument 3:
Blue Value
Description:
/lightsall red, green, blue,
cyan, magenta, yellow,
orange, pink, purple,
white, or 0-255
0-255 0-255 This adjusts all lights in a group
(targets all lights in the group of light1)
/light1 red, green, blue,
cyan, magenta, yellow,
orange, pink, purple,
white, or 0-255
0-255 0-255 This adjusts lightbulb 1
/light2 red, green, blue,
cyan, magenta, yellow,
orange, pink, purple,
white, or 0-255
0-255 0-255 This adjusts lightbulb 2
/light3 red, green, blue,
cyan, magenta, yellow,
orange, pink, purple,
white, or 0-255
0-255 0-255 This adjusts lightbulb 3
/light4 red, green, blue,
cyan, magenta, yellow,
orange, pink, purple,
white, or 0-255
0-255 0-255 This adjusts lightbulb 4
/light5 red, green, blue,
cyan, magenta, yellow,
orange, pink, purple,
white, or 0-255
0-255 0-255 This adjusts lightbulb 5
/light6 red, green, blue,
cyan, magenta, yellow,
orange, pink, purple,
white, or 0-255
0-255 0-255 This adjusts lightbulb 6
/light7 red, green, blue,
cyan, magenta, yellow,
orange, pink, purple,
white, or 0-255
0-255 0-255 This adjusts lightbulb 7
/light8 red, green, blue,
cyan, magenta, yellow,
orange, pink, purple,
white, or 0-255
0-255 0-255 This adjusts lightbulb 8
/light[x]/kelvin 1500-9000 This adjusts selected lighbulb to certain kelvin temperature (works with /lightsall)
/scene [LIFX Scene Name]

Example OSC Commands:

/lightsall purple -- This command will turn all lightbulbs Purple in a group (whatever group light 1 is in)

/lightsall 0 255 255 -- This command will turn all lightbulbs Cyan (0 Red, 255 Green, 255 Blue) in a group. (whatever group light 1 is in)

/light4 255 0 0 -- This command will only turn lightbulb 4 to Red (255 Red, 0 Green, 0 Blue)

/light8 orange -- This command will only turn lightbulb 8 to Orange

/light1/kelvin 1500 -- This command will only turn lightbulb 1 to 1500 Kelvin Temperature (Candlelight).

Kelvin temperature range on this LIFX bulb is: 1500K-9000K

/scene Spooky -- This command will activate scene "Spooky".

/scene Long Scene Title -- This command will activate scene "Long Scene Title" (This will still work if there are spaces. This basically makes a space for each argument then joins them together)

Node Installation and Setup:

  • Download or Clone this repository

  • Open in preferred source code editor (ex. Visual Studio Code or Terminal/Command Prompt)

    • If you use Visual Studio Code...
    • Go to "View > Command Palette..."
    • Type "Git: Clone" [Enter]
    • Paste the Github Clone HTTPS URL. This is the same as the URL just with ".git" added to the end (https://github.com/jshea2/NodeLifxArt-Net.git)
  • Open code editor's Terminal

  • Install 'lifxjs' & 'dmxnet': npm install (installs dependencies from 'package.json')

    (Prepend sudo if on Mac)

    or install seperately

    • npm install lifxjs
    • npm install osc-min
  • In file 'main.js' change config info..

  • Input your LIFX Token:

    //Authenticate Lifx Token
    lifx.init({ appToken: 'ENTER TOKEN HERE' });

    To find LIFX Token:

  • Input Each Lightbulb's Name:

    //ENTER NAME OF LIGHTS HERE
    let light1name = 'Wall Light'//Example
    let light2name = ''
    let light3name = ''
    let light4name = ''
    let light5name = ''
    let light6name = ''
    let light7name = ''
    let light8name = ''

    -Name Must Match in LIFX App!-

  • Configure OSC IP and Port to recieve data on:

     //OSC Server (IN) Config
      const oscServerIp = "127.0.0.1";
      const oscPortIn = 3333;
  • If you have more than 1 Lightbulb; Un-Comment all the ones you need. This can be found in three sections:

      // //Fixture 2
      // const bulb2 = await lights.find(function (light) {
      //   return light.label === light2name;
      // });
      // fixture2 = bulb2;

-This Is Currently Only Setup for 8 Lightbulbs-

  • Save 'main.js' & Run node file in Terminal: npm start [Enter]

Notes:

  • If you un-comment light fixtures that aren't available, the code will still work, but you will get errors

  • This Node file only works with LIFX Color Bulbs

  • When you first run the Node file expect an initial longer latency, because Node has to 'get' and 'find' each lightbulb's 'id'. It should be faster after that, because the 'id' values are stored from then on

  • Since these lightbulbs are connected via WiFi expect a little latency. It's about the same as controlling it from the LIFX App (my experience has been 1.5 seconds)

  • This has only been tested on a LIFX Color A19 bulb

  • The name's of each available lightbulb on the account will be logged to the console when you first run the Node file. This can be used for inputting strings to 'light1name' variables

  • See QLab file "QLabLifxOSCdemo" for a DEMO

    (Only up to 16 channels (5 Lightbulbs) on Free, Pro Audio, and Pro Video License's)

Join the Discord server to chat:

chat on Discord

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published