Filtering messages from a catch-all rtl_433

I have a rtl-sdr stick set up to receive 433.92MHz messages, and I have three temperature sensors around the house. This is my current flow:
image
Get MQTT-messages -> translate from JSON to JS object -> Filter what i want -> Switch to actually filter what I want -> Retransmit to MQTT on another topic

It’s the “Filter what I want -> Switch to actually filter what I want” part of the flow I’m not quite sure how to do. What I do now works, it just seems so hodge podge…

The filter function is like this:

let mySensors = [9, 197, 89];
msg.payload.forward = mySensors.includes(msg.payload.id);
return msg;

And then the switch sends the payloads with “forward” set to true to the new MQTT-topic.
Would you have done this any different?

(The stray link in the flow just goes to a debug node)

Like you said it works but if you want to make it a little more efficient. You could remove the switch node and just return null from the filter node on data not to pass.

let mySensors = [9, 197, 89];

if (mySensors.includes(msg.payload.id)) {
    return msg;
}

return null;