# Using start time from ical event as start for flow

**URL:** https://discourse.nodered.org/t/using-start-time-from-ical-event-as-start-for-flow/74783
**Category:** General
**Created:** [6 February 2023 13:21 UTC](https://discourse.nodered.org/t/using-start-time-from-ical-event-as-start-for-flow/74783 "2023-02-06T13:21:40Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Twiglet](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@Twiglet](https://discourse.nodered.org/u/Twiglet)
#### Post date: [6 February 2023 13:21 UTC](https://discourse.nodered.org/t/using-start-time-from-ical-event-as-start-for-flow/74783/1 "2023-02-06T13:21:40Z")

</div>

Hi all, new user here. Please be gentle!

I'm using [node-red-contrib-ical-events](https://flows.nodered.org/node/node-red-contrib-ical-events) to get the events for the next day (1 event per day) and get the start time. I'd like to pass this to some kind of trigger node to start a flow based on the Event Start time -1 hour (Trigger one hour before the event)

Example:

[iCal `EventStart` = 09:00] \> [Do something to -1 hour from `EventStart`] \> [trigger flow at `EventStart-1h`]

Ideally I would like to store the `EventStart-1h` in some kind of global variable so it can trigger multiple flows with one lookup but this isn't essential.

EG:

[iCal `EventStart`] \> [`EventStart-1h`] \> [Save to `variable`]

[Some kind of timer block using `variable`] \> [flow 1]  
[Some kind of timer block using `variable`] \> [flow 2]

Any advice would be greatly appreciated.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [6 February 2023 15:37 UTC](https://discourse.nodered.org/t/using-start-time-from-ical-event-as-start-for-flow/74783/2 "2023-02-06T15:37:00Z")

</div>

So what have ou tried so far? Please export your flow and paste it to a reply

---

<div class="post-metadata">

### Author: ![Twiglet](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@Twiglet](https://discourse.nodered.org/u/Twiglet)
#### Post date: [6 February 2023 16:14 UTC](https://discourse.nodered.org/t/using-start-time-from-ical-event-as-start-for-flow/74783/3 "2023-02-06T16:14:59Z")

</div>

Apologies if I wasn't clear. Please ignore the my initial post if it does not make sense. I will attempt to explain it better for you.

I do not have a flow that would give any more information than my first post as I do not know which nodes I might need (other than the ical node mentioned to get the ical event which outputs a string: `payload[0].eventStart` = `2023-02-07T09:00:00.000Z`).

I want to:

1. Set a a global variable from the ical flow (Done)
  - `global.foo=2023-02-07T09:00:00.000Z`

2. Use `global.foo` as the start time for other flows (Not done)

For example the `inject` node can take a time to trigger (EG: 9am) but from what I can tell I cannot use the output of one flow (the date formatted string above) as the time in the `inject` node.

I guess my question becomes, can someone advise of a node that _can_ use a global variable for the trigger time for it's flow? And if it can use it will it read the new value any time `global.foo` updates or is this locked during the `Deploy` step?

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [6 February 2023 16:33 UTC](https://discourse.nodered.org/t/using-start-time-from-ical-event-as-start-for-flow/74783/4 "2023-02-06T16:33:19Z")

</div>

Which of the three ical nodes (Trigger, Sensor or Upcoming) are you using?  
How do you have it configured?

There isn't much documentation for this node so you might want to [open an issue on the authors GitHub page](https://github.com/naimo84/node-red-contrib-ical-events/issues) and ask your question there.

---

<div class="post-metadata">

### Author: ![Twiglet](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@Twiglet](https://discourse.nodered.org/u/Twiglet)
#### Post date: [6 February 2023 16:52 UTC](https://discourse.nodered.org/t/using-start-time-from-ical-event-as-start-for-flow/74783/5 "2023-02-06T16:52:45Z")

</div>

The ical node is irrelevant. Please Ignore ical and the format of the string.

I have a global variable called `global.foo`, this contains a timestamp (in whatever format the node I'm looking for requires, again the format of this string is irrelevant), I want to use this variable in a node to trigger a flow. My problem is I have not been able to find a node which can do this, hence am looking for recommendations for such a node.

---

<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: [6 February 2023 17:18 UTC](https://discourse.nodered.org/t/using-start-time-from-ical-event-as-start-for-flow/74783/6 "2023-02-06T17:18:14Z")

</div>

One possibility is node-red-contrib-cron-plus that is widely used and well supported. You can dynamically pass it schedules of what it should do.

---

<div class="post-metadata">

### Author: ![Twiglet](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@Twiglet](https://discourse.nodered.org/u/Twiglet)
#### Post date: [6 February 2023 18:15 UTC](https://discourse.nodered.org/t/using-start-time-from-ical-event-as-start-for-flow/74783/7 "2023-02-06T18:15:25Z")

</div>

Thank you Colin. This certainly seems like the right direction. Will give it a go and mark as the solution if I can get it working.

---

<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: [20 February 2023 18:15 UTC](https://discourse.nodered.org/t/using-start-time-from-ical-event-as-start-for-flow/74783/8 "2023-02-20T18:15:48Z")

</div>

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