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:
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.