# How do I make a textbox varible timer delay

**URL:** https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525
**Category:** Dashboard
**Created:** [18 June 2020 06:16 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525 "2020-06-18T06:16:00Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [18 June 2020 06:16 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/1 "2020-06-18T06:16:00Z")

</div>

So using the normal delay function node I would like to have a textbox on the dashboard that you can put in a value and have it change the delay time to that value?  
I have:

inject "1"(every 10s)-------------------------------------------------------LED  
|  
change "1" to "0"-----[?????]---------delay 5s-----------------------^

I need this part [?????], I have used a change node but that only gives me one value not a varible one?

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [18 June 2020 09:19 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/2 "2020-06-18T09:19:50Z")

</div>

You need an input numeric box in your dashboard - put the value from that either into a message or into a variable - you can use the change node then to take the value of the variable and move that to msg.delay on the delay node

Craig

---

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [19 June 2020 06:05 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/3 "2020-06-19T06:05:52Z")

</div>

I didnt even see the numeric input...oops! how do i save the value from the box to a varible and then what do enter in the change node to get the varible so that i can move it to msg.delay?

Sorry this is only my first week ever using node red

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [19 June 2020 06:15 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/4 "2020-06-19T06:15:26Z")

</div>

Something like this (to get you started at least)

```auto
[{"id":"26df5030.3a3a3","type":"ui_numeric","z":"3a2cd7f.36bae28","name":"","label":"numeric","tooltip":"","group":"600bfa6b.a6d0f4","order":1,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":10,"step":1,"x":980,"y":620,"wires":[["59f51062.e64b8","3541ed57.972a42"]]},{"id":"59f51062.e64b8","type":"debug","z":"3a2cd7f.36bae28","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1130,"y":620,"wires":[]},{"id":"3541ed57.972a42","type":"change","z":"3a2cd7f.36bae28","name":"","rules":[{"t":"set","p":"delay","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":700,"wires":[["2e5acf4d.38c5f"]]},{"id":"2e5acf4d.38c5f","type":"delay","z":"3a2cd7f.36bae28","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1260,"y":740,"wires":[["4e6e7884.782a28"]]},{"id":"4e6e7884.782a28","type":"debug","z":"3a2cd7f.36bae28","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1300,"y":820,"wires":[]},{"id":"600bfa6b.a6d0f4","type":"ui_group","z":"","name":"Lamp","tab":"594e8662.c1e098","order":1,"disp":true,"width":"6","collapse":false},{"id":"594e8662.c1e098","type":"ui_tab","z":"","name":"Switches","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

Craig

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [19 June 2020 06:21 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/5 "2020-06-19T06:21:30Z")

</div>

You could also use the text input dashboard object as it can be free form rather than forcing you to select by climbing through the number range i..e you can type into the box

Craig

---

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [19 June 2020 06:25 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/6 "2020-06-19T06:25:30Z")

</div>

I never tried copying and importing thats pretty cool.  
But not quite what i am trying to do, i want to have a text input or numeric that will save the value then have my inject node that turns on my led trigger the change node that will take the value of the varible and use it to send to the timer each time it is tripped so that it gets turned off in whatever the varible value is. If that makes sense

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [19 June 2020 06:27 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/7 "2020-06-19T06:27:08Z")

</div>

Isnt that what this flow does ? You input into the Dashboard how many seconds delay you want and that is passed through to the delay node - whatever you want to happen will then wait for that period of time before the delay node passes it on

Craig

---

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [19 June 2020 06:29 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/8 "2020-06-19T06:29:41Z")

</div>

but it only does it once when you change the value of the numeric, if you dont change the value again the next time the timer runs it will go back to using the default delay time.  
Here is what I have:

See farther down

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [19 June 2020 06:35 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/9 "2020-06-19T06:35:30Z")

</div>

I can not import that flow - you need to make sure you have read the post about how to past a flow properly

Craig

---

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [19 June 2020 06:46 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/10 "2020-06-19T06:46:04Z")

</div>

deleted duplicate

---

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [19 June 2020 06:47 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/11 "2020-06-19T06:47:00Z")

</div>

I dragged and droped it so as not to use thge clipboard but it doesn't look like yours

---

<div class="post-metadata">

### Author: ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)
#### Post date: [19 June 2020 07:03 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/16 "2020-06-19T07:03:45Z")

</div>

Please read this post for how to properly share your flow:

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506):
>
> To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly. The easiest way to do that is to click the 'Preformatted Text' button in the toolbar: [image] Then paste in your code or flow json. You should end up with three back-tick characters - ``` - on their own line before and after the code. On standard US English keyboards, this is on the same key as the ~ character. Using the backticks will ens…

---

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [19 June 2020 07:03 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/17 "2020-06-19T07:03:56Z")

</div>

```auto
[{"id":"63d6e846.0e8318","type":"ui_led","z":"4f2cae6a.c5ec8","group":"a92077cf.7a28e8","order":4,"width":0,"height":0,"label":"Test","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"0","valueType":"num"},{"color":"green","value":"1","valueType":"num"}],"allowColorForValueInMessage":false,"name":"","x":750,"y":460,"wires":[]},{"id":"3ca31c67.d88c54","type":"inject","z":"4f2cae6a.c5ec8","name":"test","topic":"","payload":"1","payloadType":"num","repeat":"10","crontab":"","once":true,"onceDelay":"5","x":210,"y":460,"wires":[["304b5c38.c56534","63d6e846.0e8318","741a76e9.40e718"]]},{"id":"304b5c38.c56534","type":"change","z":"4f2cae6a.c5ec8","name":"Water off","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"num","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":540,"wires":[["3ad0e86d.368b98"]]},{"id":"3ad0e86d.368b98","type":"delay","z":"4f2cae6a.c5ec8","name":"Off Delay","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":600,"y":540,"wires":[["63d6e846.0e8318"]]},{"id":"741a76e9.40e718","type":"change","z":"4f2cae6a.c5ec8","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"delay","tot":"msg"},{"t":"set","p":"delay","pt":"msg","to":"delay_value","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":500,"wires":[["3ad0e86d.368b98","f8f972f2.0e18f"]]},{"id":"f8f972f2.0e18f","type":"debug","z":"4f2cae6a.c5ec8","name":"","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"delay","targetType":"msg","x":730,"y":380,"wires":[]},{"id":"cde19d5b.bf893","type":"ui_numeric","z":"4f2cae6a.c5ec8","name":"","label":"numeric","tooltip":"","group":"a92077cf.7a28e8","order":5,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":"1","max":10,"step":1,"x":340,"y":420,"wires":[["6eadcd45.8a6574"]]},{"id":"6eadcd45.8a6574","type":"change","z":"4f2cae6a.c5ec8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"delay_value","tot":"env"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":420,"wires":[[]]},{"id":"a92077cf.7a28e8","type":"ui_group","z":"","name":"dashboard","tab":"7dd97b74.960734","order":1,"disp":true,"width":"6","collapse":false},{"id":"7dd97b74.960734","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<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 August 2020 07:03 UTC](https://discourse.nodered.org/t/how-do-i-make-a-textbox-varible-timer-delay/28525/18 "2020-08-18T07:03:58Z")

</div>

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