Currently I have a subflow with a MQTT in node that receives all sensor messages and I have to filter for the one I want based on the subflow property/environment variable sensorName.
Instead of subscribing the MQTT In node to all sensor messages and then filtering, how can I subscribe it to only the sensor 'sensorName'. Is there a way for me to set the MQTT in topic to something like
qolsys/binary_sensor/${sensorName}/state
Thank you.
This interpolated format is supported if the input field is an env var. Regular fields can only support ${envvar}
see environment-variables docs for details
Since you are putting the mqtt node inside a subflow, you could set it to the value of ${topic} and in the subflow template setup, you add a topic field and allow env var values.
Alternatively , you can dynamically subscribe to any topic you desire at runtime (inside or outside of a subflow). There is built in help describing this. Also search the forum for dynamic subscribe mqtt.
1 Like
Welcome to the forum. 
I have a fairly extreme example of this:
I would normally do that as a function node instead of 6 core nodes - but it demonstrates a point.
It reads a context variable and processes a set of MQTT topics from that and starts listening to them all. With outputs going to a web page.
1 Like