# Trigger node startup question

**URL:** https://discourse.nodered.org/t/trigger-node-startup-question/39453
**Category:** General
**Created:** [20 January 2021 16:45 UTC](https://discourse.nodered.org/t/trigger-node-startup-question/39453 "2021-01-20T16:45:19Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Kazzy](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@Kazzy](https://discourse.nodered.org/u/Kazzy)
#### Post date: [20 January 2021 16:45 UTC](https://discourse.nodered.org/t/trigger-node-startup-question/39453/1 "2021-01-20T16:45:20Z")

</div>

Hi,

Just wondered if there maybe a better way to do this.

I have two trigger per diagram flow below, one to set of at 7am everyday and one at Midnight.  
these basically set some defaults for brightness etc.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/6/e64d252869de4bb51d83587de1c26d64171f8386.png)

so got this

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/2/22f72b7704e4f8a998334f7bd0026136fca8dcf6.png)

which all works fine, However if Node-Red is restarted those default do not get run  
until the appropriate time which ever is closes.. so means i have trigger it manually.

now i understand a method to run an inject node on restart is via

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/3/2308e96ec2dfaafb18fcb798cbe45638b5b1267e.png)

clicking on INJECT ONCE AFTER option...

the Repeat drop down  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/f/3f5691a531df97b552dda6e98751ba6869044e08.png)

the Inject option is available for all those EXPECT "for at a specific time" option

I wonder if that just a missed option/undersight ? would have fixed my problem lol.

The Between Times option isnt really what i want to fall back to as it just mean it going to triggering the same values for an hour(min possible)

i've got a way around as seperate inject and node but im sure I can do it better!

ta.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [20 January 2021 17:30 UTC](https://discourse.nodered.org/t/trigger-node-startup-question/39453/2 "2021-01-20T17:30:33Z")

</div>

You may wish to look at one of the more comprehensive scheduling nodes such as the cron-plus node.

---

<div class="post-metadata">

### Author: ![Kazzy](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@Kazzy](https://discourse.nodered.org/u/Kazzy)
#### Post date: [20 January 2021 23:23 UTC](https://discourse.nodered.org/t/trigger-node-startup-question/39453/3 "2021-01-20T23:23:36Z")

</div>

have to like NR as they always a few ways to do something.. not sure which way I like it 🙂

Tweaked the original one so the Trigger will send either FULL or DIM  
and use Switch and then Change node to setup the defaults.  
the Startup will just set it to Full

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

But dont like the criss-cross at the end.

or instead of the Switch and Change node just if/else in a Function

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/a/1a77c6934a7183eada23284353c1e10fb7e004f9.png)

which looks cleaner.

I do have Chronos that has a Scheduler so that works too.

Probably stick to the one with the function for now.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [21 January 2021 07:16 UTC](https://discourse.nodered.org/t/trigger-node-startup-question/39453/4 "2021-01-21T07:16:36Z")

</div>

Note that they are Inject nodes. Trigger nodes are a different node type.

---

<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: [22 March 2021 07:16 UTC](https://discourse.nodered.org/t/trigger-node-startup-question/39453/5 "2021-03-22T07:16:45Z")

</div>

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