Skip to content
NodeJS example for controlling Embrava Blynclight devices
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A simple Node.JS/Javascript example for controlling an Embrava Blynclight as a HID (Human Interface Device) object. I have actually used this set up in a TV Studio!

How to use

Assuming you have a current NodeJS installation, you will need to make sure you have the node-hid module installed (see note below if using Raspberry Pi), and then download the contents of this repository (at a minimum test.js, blync.js, device.js, and package.json) and run the sample node test.js.

To define new Blynclight devices add the dev.productId to the list on line 10 in blync.js (currently supports the standard and mini devices).

To control the light, see sample code in test.js but essentially you use:

Blync = require('./blync'); var device = Blync.getDevice(0); device.sendCommand(r, g, b,dim,blink);


  • r,g,b are the red, green, and blue colours (0-255)
  • dim is a true/false value to set the light to full brightness, or dimmed
  • blink is set to 0 for steady, 1 for 'slow', 2 for 'medium', and 3 for 'fast' blinking

By default the Blynclight will remain active and in a steady state provided power is maintained, but the test.js sample includes a device.sendCommand to deactivate the light in the exit handler

Running from a web server

The web.js file shows an example of a simple NodeJS web server that displays a form and allows you to control the lights.

I actually have it configured on my RaspberryPi to automatically start the web script following a reboot via crontab. I edit crontab using crontab -e and add the following line to the end of the file: @reboot /home/pi/blync/ That runs the script (you may need to adjust paths both in crontab and the script to suit your own configuration, as well as make the script executable chmod +x

Raspberry Pi / Raspbian

I assume you've already got a current Raspbian build on your RaspberryPi (only tested with a B+), as well as working Node environment, but if not this guide covers most of what you need to know. Note: As there isn't a predefined binary for Raspberry Pi currently, you will need to build from source and adjust permissions. To build from source see this StackOverflow post and you will need to either adjust the permissions as defined here (you can use the embrava.rules file in this repository) or run the node script with elevated permissions, eg: sudo node test.js. If you want to use the RaspberryPi as a self-contained hotspot to control the Blynclight, see these instructions.

To Do

  • add additional Blynclight devices (maybe Embrava would like to send me some to test!)
  • add the musicControl logic
  • only supports first Blynclight device it finds, what if there is >1? (need more devices to test!)
  • consolidation and optimization
  • make it all a bit more robust

If you make use of this and like it and want to give something back... I wrote a book! :)


This project can be forked from Github. Please issue pull requests from feature branches.


See Licence file in repo, or refer to

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.