0

I want to control the brightness of my LIFX bulb by injecting the value of a slider on my NodeRed Dashboard into the node-red-contrib-lifx-api node. I managed to control the light if I am using fixed values but somehow it won't take the msg.payload parameter. Also, no error message is shown on the debug stream.

my flow looks like this:

Screenshot

Is {{msg.payload}} the right syntax to use in this field? the double brackets {{ are working on my other nodes so I am using them here too.

hardillb
  • 54,545
  • 11
  • 67
  • 105

1 Answers1

0

Nodes need to be explicitly built to support pulling values in from the input message. Most of them do not use mustache ({{}}) syntax, the preferred way to do it if supported is to leave that value empty in the config dialogue (if you set a value it should not be overriden by an incoming message) and where the values come from in msg should be documented in the info side bar.

Looking at the src for the node it looks like it will take the brightness from msg.brightness so you probably want to use a change node to move the value from msg.payload to msg.brightness before the set-state node.

hardillb
  • 54,545
  • 11
  • 67
  • 105
  • Thanks! I just figured out a similar trick which works. I parse the json string from the documentation to the msg.payload Object and change the brightness: `var lampSettings = JSON.parse('{ "selector": "id:***", "power": "on", "brightness": 0.5}'); lampSettings.brightness = msg.payload; msg.payload = lampSettings;` return msg; – Markus Sadler Nov 15 '20 at 16:28