You are using NR already so stick with it.
Here is fragment of my flow which extracts brightness and warmth from circadian sensor and switch. Then store those values into sensors created from within NodeRed.
Also you can see how I joined those values into one payload in order to distribute them later on to my mqtt lights.
[{"id":"ecd4dcfe.33461","type":"trigger-state","z":"1fa6fb07.b08b25","name":"","server":"6cdd0bc8.b8e434","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"sensor.circadian_values","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":310,"y":260,"wires":[["51aef3ce.b37ab4","ca2c2e51.85c0a8"],[]]},{"id":"51aef3ce.b37ab4","type":"function","z":"1fa6fb07.b08b25","name":"WW CW","func":"var colortemp = msg.data.event.new_state.attributes.colortemp;\nvar rgb = msg.data.event.new_state.attributes.rgb_color;\nvar newmsg = \n{\n payload: {\n red: Math.round((1000000 / colortemp - 153) * 0.734870317),\n green: Math.round((500 - (1000000 / colortemp)) * 0.734870317),\n blue: 0 /*,\n gain: Math.round(100 * (rgb[0] + rgb[1] + rgb[2]) / 765)*/\n }\n \n}\nreturn newmsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":560,"y":240,"wires":[["6dd6c462.eb32a4"]]},{"id":"2ff51749.a5b8a","type":"trigger-state","z":"1fa6fb07.b08b25","name":"","server":"6cdd0bc8.b8e434","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"switch.circadian_lighting_circadian_lighting","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":250,"y":180,"wires":[["6dd15362.a10fe4","c8eac31d.c5117"],[]]},{"id":"6dd15362.a10fe4","type":"function","z":"1fa6fb07.b08b25","name":"Gain","func":"var brightness = msg.data.event.new_state.attributes.brightness;\nvar newmsg = \n{\n payload: {\n gain: Math.round(brightness)\n }\n \n}\nreturn newmsg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":180,"wires":[["6dd6c462.eb32a4"]]},{"id":"c8eac31d.c5117","type":"ha-entity","z":"1fa6fb07.b08b25","name":"sensor: cl_brightness","server":"6cdd0bc8.b8e434","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"cl_brightness"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"%"}],"state":"data.event.new_state.attributes.brightness","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":600,"y":100,"wires":[[]]},{"id":"ca2c2e51.85c0a8","type":"ha-entity","z":"1fa6fb07.b08b25","name":"sensor: cl_warmth","server":"6cdd0bc8.b8e434","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"cl_warmth"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":"K"}],"state":"data.event.new_state.attributes.colortemp","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":590,"y":300,"wires":[[]]},{"id":"6dd6c462.eb32a4","type":"join","z":"1fa6fb07.b08b25","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"0","count":"1","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":710,"y":200,"wires":[["86ebcdea.c559c8","94776893.663ee"]]},{"id":"6cdd0bc8.b8e434","type":"server","z":"","name":"Home Assistant"}]
The result is obvious