broadlink-smartbulb

1.0.1 • Public • Published

Node.JS library for Broadlink Smartbulb

A promise based Node.js module created from Python API python-broadlink for controlling Broadlink Smartbulb.

Example use

Setup a new device on your local wireless network:

  1. Put the device into AP Mode
  2. Long press the reset button until the blue LED is blinking quickly.
  3. Long press again until blue LED is blinking slowly.
  4. Manually connect to the WiFi SSID named BroadlinkProv.
  5. Run setup() and provide your ssid, network password (if secured), and set the security mode
  6. Security mode options are (0 = none, 1 = WEP, 2 = WPA1, 3 = WPA2, 4 = WPA1/2)
const broadlink = require('broadlink-smartbulb');

broadlink.setup('myssid', 'mynetworkpass', 3)

Discover available devices on the local network:

const broadlink = require('broadlink-smartbulb');

let devices = await broadlink.discover();

Obtain the authentication key required for further communication:

let device = await devices[0].auth();

Set RGB color:

await device.setRGBMode()
await device.setRed(255)
await device.setGreen(255)
await device.setBlue(0)
await device.setBrightness(100)

Get state:

console.log(await device.getState())

{
  red: 255,
  blue: 0,
  green: 255,
  pwr: 1,
  brightness: 100,
  colortemp: 2700,
  hue: 60,
  saturation: 100,
  transitionduration: 1500,
  maxworktime: 0,
  bulb_colormode: 0,
  bulb_scenes: '["@01686464,0,0,0", "#ffffff,10,0,#000000,190,0,0", "2700+100,0,0,0", "#ff0000,500,2500,#00FF00,500,2500,#0000FF,500,2500,0", "@01686464,100,2400,@01686401,100,2400,0", "@01686464,100,2400,@01686401,100,2400,@005a6464,100,2400,@005a6401,100,2400,0", "@01686464,10,0,@00000000,190,0,0", "@01686464,200,0,@005a6464,200,0,0"]',
  bulb_scene: '',
  bulb_sceneidx: 255
}

Readme

Keywords

Package Sidebar

Install

npm i broadlink-smartbulb

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

16.1 kB

Total Files

5

Last publish

Collaborators

  • pinei