boblight-js is a client library for boblight.
Node.js >= 12
npm install boblight-js --save
const boblib = require('boblight-js')
const boblightClient = new boblib.BoblightClient()
await boblightClient.connect('localhost', 19333)
boblightClient.setColorForAll(boblib.Colors.red)
boblightClient.sleep()
boblightClient.setColorForAll(new boblib.Color(0, 0, 1))
Connects to the server at host with port and priority:
connect(host = 'localhost', port = 19333, priority = 128)
Get all lights:
getLights()
Sets the color for all lights:
setColorForAll(color = new Color(0, 0, 0))
Sets the color of the specified light:
setColor(light, color = new Color(0, 0, 0))
Sets the transitioning speed of the specified light:
setSpeed(light, speed = 1)
Sets the priority of this boblight client:
setPriority(prioritiy = 128)
Checks if the boblight server answers:
ping()
Reconnects to the boblight server:
reconnect()
Sleep for msSeconds:
async sleep(msSeconds = 1000)
Creates a color: red, green, blue must be a value between 0 and 1
new Color(red = 0, green = 0, blue = 0):