HA - How would I pass a random RGB value to light.turn_on?

Hello folks, absolutely new to Node-RED (but not visual scripting / code) so appreciate any help you can provide to get me up to speed with things.

I’m using the Node-RED add-on (v20.0.0) inside of HA.

For my first flow, I thought I’d just keep things simple and setup a flow whereby a light turns on / off depending on a motion sensor. I happily managed to get that up and running:

What I want to do now though is pass a random RGB value for colour into light.turn_on. I found a node that generates a random RGB value here and installed it.

This generates a payload of a random RGB value like such:

How would I then use that data in light.turn_on?

Many thanks for your help.

I don't use HA, but a quick google for light.turn_on found the relevant documentation.

While the node you have added creates a payload "(58,150,177)" the HA node actually requires a format like this -

action: light.turn_on
target:
  entity_id: group.living_room
data:
  brightness: 120
  rgb_color: [255, 0, 0]

Since I don't know what comes out of the motion sensor node its hard to be more specific, but I would think you need a change node after the random node to move the payload value to the rgb_color property.

I would suggest reading this Performing actions - Home Assistant