Set countdown with payload

#1

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

#2

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.

1 Like
#3

Like this...

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

hi,

thanks a lot... that solves a lot of switch nodes :slight_smile: