Creating a Master Light Scene Table

Hi,

Hoping the community can help me wrap my head around this. I use Node Red to set my Home Assistant scenes and corresponding device states for each scene. Recently I upgraded my lamps from smart plugs to now having RGB smart bulbs so I have color/brightness options. With the smart plugs, it was a simple “turn_on/turn_off” syntax, but managing 20+ RGB bulbs with color/brightness options over 7 scenes is proving to be difficult.

What I’m trying to accomplish is to have an array of bulbs with their intended state (power/color/brightness) and pass it into a single call service node. I can do this with a single bulb using a function node and it works fine. Example:

var msg = 
    {
        payload:  {
            "domain": "light",
            "service": "turn_on",
            "data": {
                "entity_id": "light.desk_lamp",
                "brightness_pct": 100,
                "rgb_color": [0,0,255]
            }
        }
    }

;
return msg;

But I don’t want to have a single function node for every bulb x every scene, so I thought passing an array would be a good idea. But I can’t figure out the syntax. Is it even possible to do this? I think it would need a separate function node for each scene, with an array of each bulb and state as a json object.

Ideally, I would really like to have a “table” with a column for each scene and a row for each bulb so I can visualize/edit the state of each bulb in each scene all in one location, but I can’t figure that out either.

So I’m asking the community, how would you handle this? Maybe I’m just overlooking something simple and I’ve encountered analysis paralysis, but I would be grateful for any feedback!