The key for me was the ability to extract strings from mqtt topics (msg.topic) with regex’s.
Eg. using node red’s Change node and jsonata expressions:
$match(topic, /binary_sensor.(cam_\w{5})_motion/).groups[0].$string()
That gives you ‘bacon’ in binary_sensor.cam_bacon_motion. Set msg.data.foo to that and the flow can be used for anything matching the regex. Moreover, you can use $.data.foo in the same change node to set other msg.*
It’s really powerful.