This is my most recent update to the CT flow I have in my house. I bought another dozen CT/Full Color bulbs this week and the old fan-out style of setting CT seemed like it was starting to lag. Now that the Node-Red supports more generic configurations, I put this "universal CT management" together.
Coupled with the CT calculation, which is stored in a flow variable:
Previously, my config looked like this. It required manually adding a node for each bulb, and it scaled traffic per CT update too aggressively.
Here's the code for the universal CT updater:
[{"id":"58e0ec60.bafb94","type":"hubitat event","z":"f9337f21.0eab78","name":"All Events","server":"252d4ef4.c14b6a","x":140,"y":260,"wires":[["94dde739.518ef8"]]},{"id":"94dde739.518ef8","type":"switch","z":"f9337f21.0eab78","name":"== switch","property":"payload.name","propertyType":"msg","rules":[{"t":"eq","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":280,"y":260,"wires":[["9c7a6454.dc21f"]]},{"id":"9c7a6454.dc21f","type":"switch","z":"f9337f21.0eab78","name":"== on","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":410,"y":260,"wires":[["c8190e0a.7f7a48"]]},{"id":"bccb5224.c91e6","type":"hubitat device","z":"f9337f21.0eab78","deviceLabel":"","name":"","server":"252d4ef4.c14b6a","deviceId":"","attribute":"","sendEvent":false,"x":750,"y":260,"wires":[["e473965f.8a5b68"]]},{"id":"c8190e0a.7f7a48","type":"change","z":"f9337f21.0eab78","name":"","rules":[{"t":"set","p":"deviceId","pt":"msg","to":"payload.deviceId","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":260,"wires":[["bccb5224.c91e6"]]},{"id":"60321171.83d2c8","type":"comment","z":"f9337f21.0eab78","name":"When a device is turned on, check if it's a CT bulb","info":"","x":270,"y":200,"wires":[]},{"id":"e473965f.8a5b68","type":"switch","z":"f9337f21.0eab78","name":"CT Bulb?","property":"payload","propertyType":"msg","rules":[{"t":"hask","v":"colorTemperature","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":890,"y":260,"wires":[["33ed496c.3b1f1e"]]},{"id":"10420ba7.156514","type":"change","z":"f9337f21.0eab78","name":"Set Color Temp","rules":[{"t":"set","p":"arguments","pt":"msg","to":"color_temperature","tot":"flow"},{"t":"set","p":"command","pt":"msg","to":"setColorTemperature","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":220,"y":580,"wires":[["c1b27dbf.a11668"]]},{"id":"c1b27dbf.a11668","type":"hubitat command","z":"f9337f21.0eab78","deviceLabel":"","name":"","server":"252d4ef4.c14b6a","deviceId":"","command":"","commandArgs":"","x":400,"y":580,"wires":[[]]},{"id":"33ed496c.3b1f1e","type":"link out","z":"f9337f21.0eab78","name":"Bulb turned on","links":["950cba8b.112ef8"],"x":995,"y":260,"wires":[]},{"id":"950cba8b.112ef8","type":"link in","z":"f9337f21.0eab78","name":"Bulb CT Update","links":["33ed496c.3b1f1e","a197e4e7.48a7c"],"x":95,"y":580,"wires":[["10420ba7.156514"]]},{"id":"b3231329.c6083","type":"hubitat request","z":"f9337f21.0eab78","name":"Fetch all devices","server":"252d4ef4.c14b6a","path":"/devices/all","x":230,"y":400,"wires":[["21b8a5fd.7a31d2"]]},{"id":"21b8a5fd.7a31d2","type":"split","z":"f9337f21.0eab78","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":375,"y":400,"wires":[["7bc998fc.ab71a"]],"l":false},{"id":"7bc998fc.ab71a","type":"switch","z":"f9337f21.0eab78","name":"CT Bulb?","property":"payload.capabilities","propertyType":"msg","rules":[{"t":"cont","v":"ColorTemperature","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":480,"y":400,"wires":[["37a242c8.10feb6"]]},{"id":"37a242c8.10feb6","type":"switch","z":"f9337f21.0eab78","name":"On?","property":"payload.attributes.switch","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":630,"y":400,"wires":[["65f9e584.babbf4"]]},{"id":"a197e4e7.48a7c","type":"link out","z":"f9337f21.0eab78","name":"","links":["950cba8b.112ef8"],"x":1195,"y":400,"wires":[]},{"id":"dc311cbd.e678c8","type":"link in","z":"f9337f21.0eab78","name":"Update All Bulbs CT","links":["b0c8d31a.f0e56"],"x":95,"y":400,"wires":[["b3231329.c6083"]]},{"id":"6c75f0cf.aaaf68","type":"comment","z":"f9337f21.0eab78","name":"When the CT target is updated, pull and update all active bulbs","info":"","x":310,"y":340,"wires":[]},{"id":"eef4c6a1.ea14a","type":"comment","z":"f9337f21.0eab78","name":"Update a single bulb","info":"","x":170,"y":500,"wires":[]},{"id":"145e840c.2ed744","type":"delay","z":"f9337f21.0eab78","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1050,"y":400,"wires":[["a197e4e7.48a7c"]]},{"id":"d820eb75.8fe88","type":"change","z":"f9337f21.0eab78","name":"Set Device ID","rules":[{"t":"set","p":"deviceId","pt":"msg","to":"payload.id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":935,"y":400,"wires":[["145e840c.2ed744"]],"l":false},{"id":"65f9e584.babbf4","type":"switch","z":"f9337f21.0eab78","name":"CT is Wrong?","property":"payload.attributes.colorTemperature","propertyType":"msg","rules":[{"t":"btwn","v":"$flowContext(\"color_temperature\")-25","vt":"jsonata","v2":"$flowContext(\"color_temperature\")+25","v2t":"jsonata"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":800,"y":400,"wires":[[],["d820eb75.8fe88"]]},{"id":"252d4ef4.c14b6a","type":"hubitat config","name":"Hubitat","usetls":false,"host":"172.16.0.27","port":"80","appId":"501","nodeRedServer":"http://172.16.0.25:1880","webhookPath":"/hubitat/webhook","autoRefresh":false,"useWebsocket":false}]
And for the CT engine:
[{"id":"78d27aa4.3a922c","type":"change","z":"f9337f21.0eab78","name":"","rules":[{"t":"set","p":"color_temperature","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1540,"y":920,"wires":[["acfe6604.b0ebd","b0c8d31a.f0e56"]]},{"id":"e1e38786.f7807","type":"inject","z":"f9337f21.0eab78","name":"Every 15 minutes","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"900","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":860,"wires":[["7a1e014f.2d5688"]]},{"id":"e19e918a.2851d","type":"hubitat mode","z":"f9337f21.0eab78","name":"","server":"252d4ef4.c14b6a","sendEvent":true,"x":130,"y":920,"wires":[["7a1e014f.2d5688"]]},{"id":"7a1e014f.2d5688","type":"delay","z":"f9337f21.0eab78","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":415,"y":920,"wires":[["82929842.1531"]],"l":false},{"id":"b0c8d31a.f0e56","type":"link out","z":"f9337f21.0eab78","name":"Color Temperature Updated","links":["ac7411a0.a83e9","dc311cbd.e678c8"],"x":1715,"y":980,"wires":[]},{"id":"c5d2e3b6.bd6a4","type":"link in","z":"f9337f21.0eab78","name":"","links":["b7421877.47f01","910d19f9.d725e8","de178a7c.7f5e38"],"x":95,"y":1020,"wires":[["8fa8cca6.3c39b8"]]},{"id":"8fa8cca6.3c39b8","type":"delay","z":"f9337f21.0eab78","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"30","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":220,"y":1020,"wires":[["7a1e014f.2d5688"]]},{"id":"9a110e75.82802","type":"range","z":"f9337f21.0eab78","minin":"0","maxin":"100","minout":"2500","maxout":"4200","action":"clamp","round":true,"property":"payload","name":"percent to kelvin range","x":1260,"y":920,"wires":[["78d27aa4.3a922c"]]},{"id":"17a47889.a03a2f","type":"sun-position","z":"f9337f21.0eab78","name":"","positionConfig":"96c207ac.2237a8","rules":[],"onlyOnChange":"true","topic":"","outputs":1,"start":"","startType":"none","startOffset":0,"startOffsetType":"none","startOffsetMultiplier":60000,"end":"","endType":"none","endOffset":0,"endOffsetType":"none","endOffsetMultiplier":60000,"x":790,"y":940,"wires":[["f183b6f5.423ec"]]},{"id":"f183b6f5.423ec","type":"change","z":"f9337f21.0eab78","name":"Set Auto Color Temp","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.altitudePercent","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":940,"wires":[["9a110e75.82802"]]},{"id":"82929842.1531","type":"switch","z":"f9337f21.0eab78","name":"","property":"manual_ct.enabled","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":630,"y":920,"wires":[["d992f052.6d2dd8"],["17a47889.a03a2f"]]},{"id":"d992f052.6d2dd8","type":"change","z":"f9337f21.0eab78","name":"Set Manual CT","rules":[{"t":"set","p":"payload","pt":"msg","to":"manual_ct.value","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":900,"wires":[["9a110e75.82802"]]},{"id":"c0cc2888.9c36f8","type":"link in","z":"f9337f21.0eab78","name":"","links":["24b1694e.8d6176"],"x":95,"y":980,"wires":[["7a1e014f.2d5688"]]},{"id":"e834d70c.0d45a8","type":"comment","z":"f9337f21.0eab78","name":"Set the target color temperature for the house","info":"","x":250,"y":800,"wires":[]},{"id":"252d4ef4.c14b6a","type":"hubitat config","name":"Hubitat","usetls":false,"host":"172.16.0.27","port":"80","appId":"501","nodeRedServer":"http://172.16.0.25:1880","webhookPath":"/hubitat/webhook","autoRefresh":false,"useWebsocket":false},{"id":"96c207ac.2237a8","type":"position-config","name":"Home","isValide":"true","longitude":"0","latitude":"0","angleType":"deg","timeZoneOffset":"99","timeZoneDST":"0","stateTimeFormat":"3","stateDateFormat":"12"}]
I try to do as much as possible without third party nodes, but used the CT work from the node-red-contrib-sun-position library.
Hope you find this useful or enjoyable.