Get Entities - set rules node red

I have been trying to figure out how to add multiple rules in node red for the get entities rules array before I call that object. Can someone show me an example?

I use the get entities object to get all objects and then check if it is a light or a switch to turn on or off everything. I call this from multiple flows but there are times I want to exclude one or two items. So I need to override the rules with the array but I am unsure how to do it:

"rules": [
            {
                "property": "entity_id",
                "logic": "does_not_include",
                "value": "switch.front_door_outside_light_switch",
                "valueType": "str"
            },
            {
                "property": "entity_id",
                "logic": "does_not_include",
                "value": "switch.alarm_plug_on_off",
                "valueType": "str"
            }

I tried something like this in a function:

var arrules = ["entity_id","does_not_include","switch.alarm_plug_on_off","str"]
msg.payload = {"rules":arrules}
return msg;

but the message just comes back with “”[0]" must be of type object".

I also want to pass in multiple arrays and unsure how to do that.

Thanks, J

Are you wanting to merge the exclude rules with what is existing in the get-entities node? Not currently possible.

If you just want to overwrite them it would be in the format of the first code block.

msg.payload = {
    rules: [
            {
                property: "entity_id",
                logic: "does_not_include",
                value: "switch.front_door_outside_light_switch",
                valueType: "str"
            },
            {
                property: "entity_id",
                logic: "does_not_include",
                value: "switch.alarm_plug_on_off",
                valueType: "str"
            }
    ]
};

return msg;