How do I make a textbox varible timer delay

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?

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

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

Something like this (to get you started at least)

[{"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

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

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

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

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

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

Craig

deleted duplicate

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

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

[{"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}]
1 Like

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