broadlink-smartbulb
v1.0.1
Published
A promise based Node.js module for Broadlink controllers
Downloads
3
Readme
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:
- Put the device into AP Mode
- Long press the reset button until the blue LED is blinking quickly.
- Long press again until blue LED is blinking slowly.
- Manually connect to the WiFi SSID named BroadlinkProv.
- Run setup() and provide your ssid, network password (if secured), and set the security mode
- 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
}