# Simple "If input is then start flow" function

**URL:** <https://discourse.nodered.org/t/simple-if-input-is-then-start-flow-function/49912>\
**Category:** General\
**Created:** [19 August 2021 12:12 UTC](https://discourse.nodered.org/t/simple-if-input-is-then-start-flow-function/49912 "2021-08-19T12:12:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thotho131097](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thotho131097/32/46727_2.png) [@Thotho131097](https://discourse.nodered.org/u/Thotho131097)\
**Post date:** [19 August 2021 12:12 UTC](https://discourse.nodered.org/t/simple-if-input-is-then-start-flow-function/49912/1 "2021-08-19T12:12:52Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/e/5ec037d6e4d837028b587cf0eaa3491d763717ef.png)  
Contents of the function are:

```auto
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? 🙂

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [19 August 2021 19:38 UTC](https://discourse.nodered.org/t/simple-if-input-is-then-start-flow-function/49912/2 "2021-08-19T19:38:35Z")

</div>

> [@Thotho131097](#):
>
> on my RF remote

> [@Thotho131097](#):
>
> a flow which verify's if a button is pressed

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 October 2021 19:38 UTC](https://discourse.nodered.org/t/simple-if-input-is-then-start-flow-function/49912/3 "2021-10-18T19:38:45Z")

</div>

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