Dynamically set a "trigger node"

1,048 views
Skip to first unread message

David Dempster

unread,
Aug 8, 2017, 1:49:41 PM8/8/17
to Node-RED
Hi,
I've got a Raspi-Camera set-up to take a picture and send it ti ui-template and FTP to my web site.

What I would like to do is create a set of buttons (in the dashboard) that specify how often to take a picture.

So my question is... is there a way to send a "value" into a trigger or delay node ?

I've hunted around and not found anything that relates to what I want to do.

Cheers from David.

Dave C-J

unread,
Aug 8, 2017, 3:24:04 PM8/8/17
to node...@googlegroups.com
Yes you can set the delay node to accept the delay time as input..
(In version 0.17.x)


sent from phone

David Dempster

unread,
Aug 10, 2017, 9:07:57 AM8/10/17
to Node-RED
I took Dave C-J's advice and played around with inputting a value into a delay node.

Although the attached flow works fine, what I would like it to do is change delay as soon as an inject node is pressed.
At the moment it only changes the value after the delay period has expired.
I've tried injecting msg.reset=0 but can't find the best place to make it work.

Maybe a fresh set of eyes might help.

Background
What I'm planning on doing is create a control system for a RPi camera.
I've got the camera capture working - which sends the image to the dashboard and via FTP to my server.
The plan is to have some buttons on the dashboard to control the capture speed, image reference (i.e. numerical or datestamp) as well as Run/STOP.

Cheers from David
selectable_delay.txt

Bart Butenaers

unread,
Aug 10, 2017, 11:06:59 AM8/10/17
to Node-RED
Hi David,

Perhaps you could use my node-red-contrib-msg-resend node to accomplish this?

You could enter the capture speed on your dashboard and convert it someway to the resend interval (i.e. interval between two camera capture triggers).
Then set the new resend interval to the resend node, which will create a new timer (and cleanup the old timer of the previous capture speed).
Something like this:

[{"id":"462d78cc.04fa68","type":"inject","z":"f711b886.a58148","name":"Send trigger every second","topic":"","payload":"Some trigger","payloadType":"str","repeat":"","crontab":"","once":false,"x":382.765625,"y":593.25,"wires":[["a85da862.176968"]]},{"id":"ce4f1a39.6665a8","type":"msg-resend","z":"f711b886.a58148","interval":"1","maximum":"0","bytopic":false,"clone":false,"name":"Send triggers to camera","x":854.1476554870605,"y":641.5207786560059,"wires":[["fc7fb0d0.1ba83"]]},{"id":"fc7fb0d0.1ba83","type":"debug","z":"f711b886.a58148","name":"Trigger info","active":true,"console":"false","complete":"true","x":1066.7657012939453,"y":641.2500114440918,"wires":[]},{"id":"bf67c3c2.20b34","type":"inject","z":"f711b886.a58148","name":"Send trigger every 5 seconds","topic":"","payload":"Another trigger","payloadType":"str","repeat":"","crontab":"","once":false,"x":390.7657012939453,"y":642.2499389648438,"wires":[["39adf51f.3a1bda"]]},{"id":"39adf51f.3a1bda","type":"change","z":"f711b886.a58148","name":"Settings","rules":[{"t":"set","p":"resend_interval","pt":"msg","to":"5","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":611.765625,"y":642.25,"wires":[["ce4f1a39.6665a8"]]},{"id":"f8b16886.4fc188","type":"inject","z":"f711b886.a58148","name":"STOP","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":319.7657165527344,"y":689.2499370574951,"wires":[["88fb708e.adcd9"]]},{"id":"88fb708e.adcd9","type":"change","z":"f711b886.a58148","name":"Ignore","rules":[{"t":"set","p":"resend_ignore","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":621.7657165527344,"y":689.2499370574951,"wires":[["ce4f1a39.6665a8"]]},{"id":"a85da862.176968","type":"change","z":"f711b886.a58148","name":"Settings","rules":[{"t":"set","p":"resend_interval","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":612.765625,"y":593.25,"wires":[["ce4f1a39.6665a8"]]}]

Maybe this way you could get a flow that is simpler ??

Kind regards,
Bart

David Dempster

unread,
Aug 10, 2017, 11:48:29 AM8/10/17
to Node-RED

Hi Bart,
Thanks for your response - I'll try it out this evening.

Thanks again.

Cheers from David.

David Dempster

unread,
Aug 10, 2017, 12:15:59 PM8/10/17
to Node-RED
Hi Bart,
Just tried your out "re-send" node - I think it will be the perfect answer for my project.

Thanks again.

Bart Butenaers

unread,
Aug 10, 2017, 1:44:18 PM8/10/17
to Node-RED
Hi David,

Glad we could help you.  If you have finished your flow for setting the capture speed via the dashboard, please post it here.  I will need something similar in the near future...

Greetings,
Bart
Reply all
Reply to author
Forward
0 new messages