# HA - How would I pass a random RGB value to light.turn\_on?

**URL:** <https://discourse.nodered.org/t/ha-how-would-i-pass-a-random-rgb-value-to-light-turn-on/98715>\
**Category:** General\
**Tags:** home-assistant\
**Created:** [18 August 2025 12:18 UTC](https://discourse.nodered.org/t/ha-how-would-i-pass-a-random-rgb-value-to-light-turn-on/98715 "2025-08-18T12:18:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Temmy](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@Temmy](https://discourse.nodered.org/u/Temmy)\
**Post date:** [18 August 2025 12:18 UTC](https://discourse.nodered.org/t/ha-how-would-i-pass-a-random-rgb-value-to-light-turn-on/98715/1 "2025-08-18T12:18:35Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e0b5eaefeda74cf38d597ba3a66efebe5e7dcc69.png)

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](https://flows.nodered.org/node/random-generator_node-red-contrib) and installed it.

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/e/5e8eb8db5afb614b24a7cc9e3594e977ba9e279c.png)

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

Many thanks for your help.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [18 August 2025 13:19 UTC](https://discourse.nodered.org/t/ha-how-would-i-pass-a-random-rgb-value-to-light-turn-on/98715/2 "2025-08-18T13:19:22Z")

</div>

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 -

```auto
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](https://www.home-assistant.io/docs/scripts/perform-actions/)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 November 2025 13:20 UTC](https://discourse.nodered.org/t/ha-how-would-i-pass-a-random-rgb-value-to-light-turn-on/98715/3 "2025-11-16T13:20:03Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
