Changing Light RGB Color using a variable

Hello everyone, I'm new to Node-RED but I've played around with programming for a while. What I'm looking to do seems easy but I can't figure out how to make it work. I query a Weather site to get Weather information. I've created a Flow variable that contains the value for a tempature. I want to change a light color to reflect that variable, something like rbg_color: [0,0,variable]. I've tried different syntax combinations and just can't get it to work. I'm using a Call Service node to send this information to Home Assistant. I've spent many hours on Google without finding anything that helps. I hope this forum can shed some light or a direction to help me resolve this.

This could be done many ways but here is 1 example using a range node and a change node.

[{"id":"86bc09d2.197af8","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":150,"y":4680,"wires":[["eed63582.5c5e98"]]},{"id":"eed63582.5c5e98","type":"range","z":"b779de97.b1b46","minin":"-20","maxin":"40","minout":"0","maxout":"255","action":"scale","round":false,"property":"payload","name":"","x":330,"y":4700,"wires":[["a39fc78d.8e1838"]]},{"id":"1da1b728.0edc39","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"20","payloadType":"num","x":180,"y":4720,"wires":[["eed63582.5c5e98"]]},{"id":"a39fc78d.8e1838","type":"change","z":"b779de97.b1b46","name":"","rules":[{"t":"set","p":"rbg_color","pt":"msg","to":"[0,0,$round($$.payload)]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":4700,"wires":[["148aa5f6.67a06a"]]},{"id":"148aa5f6.67a06a","type":"debug","z":"b779de97.b1b46","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"rbg_color","targetType":"msg","statusVal":"","statusType":"auto","x":610,"y":4760,"wires":[]}]

Appreciate the quick response but how do I input this into node-RED?

Ignore last post, figured that part out. Thanks again

E1cid...hate to be a pain but I still can't figure out how to input this into a 'Call Service' node. I hopefully attached the appropriate code for you to see what I'm doing.

[{"id":"8ad312da47accf81","type":"api-call-service","z":"e3336dd6041e40a8","name":"B1","server":"ea96c16f.d336c","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.b1","data":"{"rgb_color":[0,0,0]}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":,"queue":"none","x":1060,"y":580,"wires":[]},{"id":"ea96c16f.d336c","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

I do not us Home Assistant, but looking at your code posted it looks like it accepts jsonata in the api-call-service node. If so you can probably copy the expression from the change node and use it direct in the api node.

when posting code you need to use the </> button and paste between back ticks, otherwise the code is corrupted by the forum formatting.

That worked.....you the man E1cid.....thanks again