Joery-M / Govee-LAN-Control

An Node.js package to control Govee devices with LAN
https://joery.com/govee-lan-control
MIT License
21 stars 4 forks source link

setColor via json is not working #4

Closed hoschult closed 1 year ago

hoschult commented 1 year ago

Hi, I try to set color of my give led strip. Works fine with builtin color picker; However I stuck to inject a json color scheme to setColor node. I tried with:

image

However, it does not work. Can anybody share an example how to inject color via json to setColor node?

Thanks

hoschult commented 1 year ago

also tried something like this:

image

but without luck.... Led strip turns off

Joery-M commented 1 year ago

Sorry for taking WAY too long to respond.

The value of msg.payload has to be one of these:

{
  "rgb": [255, 255, 0]
}
{
  "hex": "#000004"
}
{
  "hsl": [100, 50, 100]
}
{
  "kelvin": 4000
}
hoschult commented 1 year ago

thanks.

When feeding the the setColor node with

{ "rgb": [ 128, 8, 54] }

I got an node red crash

2 Apr 17:13:53 - [red] Uncaught Exception: 2 Apr 17:13:53 - [error] TypeError: Cannot read properties of undefined (reading 'devicesArray') at setColorNode._inputCallback (/home/pi/.node-red/node_modules/govee-lan-control/dist/node-red/setColor.js:12:24) at /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:210:26 at Object.trigger (/usr/lib/node_modules/node-red/node_modules/@node-red/util/lib/hooks.js:166:13) at setColorNode.Node._emitInput (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:202:11) at setColorNode.Node.emit (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:186:25) at setColorNode.Node.receive (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:485:10) at Immediate.<anonymous> (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:831:52) at processImmediate (node:internal/timers:475:21)