# Set countdown with payload

**URL:** <https://discourse.nodered.org/t/set-countdown-with-payload/10300>\
**Category:** General\
**Created:** [17 April 2019 18:32 UTC](https://discourse.nodered.org/t/set-countdown-with-payload/10300 "2019-04-17T18:32:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flixm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flixm/32/17122_2.png) [@Flixm](https://discourse.nodered.org/u/Flixm)\
**Post date:** [17 April 2019 18:32 UTC](https://discourse.nodered.org/t/set-countdown-with-payload/10300/1 "2019-04-17T18:32:23Z")

</div>

Hi,  
i search for a node which allows me to set the countdown by a payload.

I want to set the timing of my blinds by trigger the time of the motor time. e.g.: 30 sec half way and 60 sec full down or up etc.  
So in my case i told google to set the blinds to 50 percent. it give me a payload with "50" then the timer should set to 50 seconds till it sends the stop message.

I could not find a timer or countdown which i can set like that. i also tried to use the delay node, but i could not find out how to set the delay by a payload or whatever.

thank in advance

Felix

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 April 2019 18:41 UTC](https://discourse.nodered.org/t/set-countdown-with-payload/10300/2 "2019-04-17T18:41:41Z")

</div>

Use a change node or function node to set `msg.delay` to your value then feed that to the delay node then to your device.

The info on the side panel (when delay node is selected) tells you how to dynamically set the delay.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [17 April 2019 18:48 UTC](https://discourse.nodered.org/t/set-countdown-with-payload/10300/3 "2019-04-17T18:48:00Z")

</div>

Like this...

```auto
[{"id":"e52411f3.15c09","type":"delay","z":"31e18edc.98bdc2","name":"","pauseType":"delayv","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":500,"y":480,"wires":[["cbd406e8.189568"]]},{"id":"2d69842b.e2eb0c","type":"change","z":"31e18edc.98bdc2","name":"Move payload to msg.delay","rules":[{"t":"set","p":"delay","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":430,"wires":[["e52411f3.15c09"]]},{"id":"6c27991b.6a00c8","type":"inject","z":"31e18edc.98bdc2","name":"Delay in milliseconds","topic":"","payload":"30000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":370,"y":430,"wires":[["2d69842b.e2eb0c"]]},{"id":"cbd406e8.189568","type":"debug","z":"31e18edc.98bdc2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":730,"y":480,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![Flixm](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/flixm/32/17122_2.png) [@Flixm](https://discourse.nodered.org/u/Flixm)\
**Post date:** [19 April 2019 18:10 UTC](https://discourse.nodered.org/t/set-countdown-with-payload/10300/4 "2019-04-19T18:10:14Z")

</div>

hi,

thanks a lot... that solves a lot of switch nodes 🙂
