Simple "If input is then start flow" function

Hi All,

I am kind of new to NODE RED and JS.
I am trying to create a flow for the following:
When a button is pressed on my RF remote, the flow must add 10 to brightness and sent MQTT message with the new value. (Button pressed is input from MQTT but emulated by a inject node at the moment), current brightness is input from MQTT WLED).

Ive created the following flow to add 10 to current value, the output is correct (10 more then current value input):

Contents of the function are:

var amount = 10;
var newmsg;

newmsg = parseInt(msg.payload, 10)
msg.payload = newmsg + amount
return msg;

Now I'd like to create a flow which verify's if a button is pressed, if yes this functions should be executed.
I've tried many solutions but do not seems to find a solution.
Can anyone help me? :slight_smile:

What hardware solution are you using to detect the remote's RF signal? And what, if any, contrib are you using to read said hardware's input? A functional solution for this should have already given you the tools to detect a button press.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.