Implementing two inputs in Node-RED
You will need to use a function node and make use of the context
variable to keep state between messages and use the message topic to determine which input a message came from.
Something like this:
context.temp = context.temp || 0.0;
context.smoke = context.smoke || false;
if (msg.topic === 'smokeDetector') {
context.smoke = msg.payload;
} else if (msg.topic === 'tempSensor') {
context.temp = msg.payload;
}
if (context.temp >= 70.0 && context.smoke) {
return {topic: 'fireState', payload: 'FIRE!'}
} else {
return null
}
More details can be found in the function node doc here