# Disabling manual flow inject

**URL:** <https://discourse.nodered.org/t/disabling-manual-flow-inject/82452>\
**Category:** General\
**Created:** [29 October 2023 20:17 UTC](https://discourse.nodered.org/t/disabling-manual-flow-inject/82452 "2023-10-29T20:17:19Z")\
**Posts on this page:** 8\
**Page:** 1

<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:** [29 October 2023 20:17 UTC](https://discourse.nodered.org/t/disabling-manual-flow-inject/82452/1 "2023-10-29T20:17:19Z")

</div>

I have a flow which calculates financial compounded interest from savings.  
The flow runs every midnight, and each subsequent node in the flow then does a calculation from saved context values, and outputs the amount of interest accrued in the previous 24hrs.  
The output then is stored in influx and plotted in a grafana chart.  
Grafana can then aggregate the values for the relevant tax year, and present the data in chart form.  
All good & working OK, except if the inject node that starts the flow is accidently pressed, then the daily interest calculation would be run twice in that 24hrs, and therefore create a false daily amount. I would then have to manually go into influx and delete the data from that inject.

I know that I should take more care 🙄 but with inquisitive grandkids, dodgy mousepad, bad eyesight, etc...

Anyone know how to run a flow only once at each midnight, without exposing the manual inject button?  
Cron+ has the same manual button, and I've also looked at adding a delay node set to rate-limit 1 message per 1439 minutes (but it of course forgets the message count if my server is rebooted).

---

<div class="post-metadata">

**Author:** ![pticon91](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pticon91/32/84250_2.png) [@pticon91](https://discourse.nodered.org/u/pticon91)\
**Post date:** [29 October 2023 20:55 UTC](https://discourse.nodered.org/t/disabling-manual-flow-inject/82452/2 "2023-10-29T20:55:46Z")

</div>

Lock the flow and inject nodes will not be clickable. I have all flows locked per default, which prevents me to move nodes by accident and so on.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/0/80a30772230482fadf1a3b981fe3088e5a63f6cb.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [29 October 2023 21:28 UTC](https://discourse.nodered.org/t/disabling-manual-flow-inject/82452/3 "2023-10-29T21:28:05Z")

</div>

How about delay node set to rate limit 1 message per 24hr.  
Or a switch node to check the the time is between a certain time using JSONata and $moment().

---

<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:** [29 October 2023 22:57 UTC](https://discourse.nodered.org/t/disabling-manual-flow-inject/82452/12 "2023-10-29T22:57:40Z")

</div>

> [@Paul-Reed](#):
>
> Anyone know how to run a flow only once at each midnight, without exposing the manual inject button

If you add 2 schedules to cron-plus the inject button is removed. You can set the 2nd schedule to a point in the past so it never triggers.

---

<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:** [29 October 2023 23:07 UTC](https://discourse.nodered.org/t/disabling-manual-flow-inject/82452/13 "2023-10-29T23:07:22Z")

</div>

@pticon91 David, thanks, I'll give this a try as it would also prevent any deletions and keeps the nodes from being moved.

> [@E1cid](#):
>
> How about delay node set to rate limit 1 message per 24hr

I've tried that;

> [@Paul-Reed](#):
>
> I've also looked at adding a delay node set to rate-limit 1 message per 1439 minutes (but it of course forgets the message count if my server is rebooted).

> [@E1cid](#):
>
> a switch node to check the the time is between a certain time using JSONata and $moment().

But if David's solution doesn't work out, this also sounds a good solution. Thanks.

---

<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:** [29 October 2023 23:23 UTC](https://discourse.nodered.org/t/disabling-manual-flow-inject/82452/14 "2023-10-29T23:23:38Z")

</div>

Did this not satisfy your original requirement?

> [@Steve-Mcl](#):
>
> If you add 2 schedules to cron-plus the inject button is removed. You can set the 2nd schedule to a point in the past so it never triggers

If not then an alternative is to remove all Cron schedules and manually inject a dynamic schedule from an on start inject node.

Both solutions do what you ask.

---

<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:** [29 October 2023 23:27 UTC](https://discourse.nodered.org/t/disabling-manual-flow-inject/82452/15 "2023-10-29T23:27:23Z")

</div>

> [@Steve-Mcl](#):
>
> Did this not satisfy your original requirement?

Sorry, I didn't see your post before I posted.

> [@Steve-Mcl](#):
>
> If you add 2 schedules to cron-plus the inject button is removed. You can set the 2nd schedule to a point in the past so it never triggersed

I knew about adding 2 schedules removing the inject button, but didn't think about setting the 2nd schedule to a point in the past 🙄

Thanks Steve.

---

<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:** [12 November 2023 23:28 UTC](https://discourse.nodered.org/t/disabling-manual-flow-inject/82452/16 "2023-11-12T23:28:04Z")

</div>

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