methods
events
methods
constructor(host, port, name)
constructs a new openrgb Client
parameter | type | optional | default | description |
---|---|---|---|---|
name | string | y | nodejs | name for openrgb |
port | int | y | 6742 | port of sdk server |
host | string | y | localhost | device of sdk server |
let client = new Client()
.getControllerCount()
returns the amount of devices connected to OpenRGB
returns:
Promise<
integer
>
let amount = await client.getControllerCount()
.getControllerData(deviceId)
returns device data of specified device
parameter | type | optional | description |
---|---|---|---|
deviceId | int | n | device index |
returns:
Promise<Device>
let device1 = await client.getControllerData(1)
.getProtocolVersion()
returns the version of the protocol
returns:
Promise<
integer
>
let protocol = await client.getProtocolVersion()
.updateLeds(deviceId, colors)
updates leds with the given colors
parameter | type | optional | description |
---|---|---|---|
deviceId | int | n | device index |
colors | array<color> | n | array of rgb color objects |
returns:
Promise<>
await client.updateLeds(1, Array(device.colors.count).fill({red: 0, green: 128, blue: 128}))
.updateZoneLeds(deviceId, zoneId, colors)
updates leds of specific zone with the given colors
parameter | type | optional | description |
---|---|---|---|
deviceId | int | n | device index |
zoneId | int | n | zone index for device |
colors | array<color> | n | array of rgb color objects |
returns:
Promise<>
await client.updateZoneLeds(1, 2, Array(device.zones[2].ledsCount).fill({red: 0, green: 128, blue: 128}))
.updateMode(deviceId)
changes the mode of the device to a specific mode
parameter | type | optional | description |
---|---|---|---|
deviceId | int | n | device index |
mode | int|string | n | either name or id of a mode |
returns:
Promise<>
await client.setCustomMode(1)
.setCustomMode(deviceId)
Sets the device to its mode for individual led control (or an equivalent)
parameter | type | optional | description |
---|---|---|---|
deviceId | int | n | device index |
returns:
Promise<>
await client.setCustomMode(1)
.resizeZone(deviceId, zoneId, zoneLength)
changes the amount of leds of a zone
parameter | type | optional | description |
---|---|---|---|
deviceId | int | n | device index |
zoneId | int | n | zone index for device |
zoneLength | int | n | new amount of leds |
returns:
Promise<>
await client.resizeZone(1, 2, 45)
methods
connect
emitted when the Client successfully connects to the openrgb sdk
client.on("connect", () => console.log("connected!"))
disconnect
emitted when the connection to the openrgb sdk ends
client.on("disconnect", () => console.log("disconnected!"))