# Sequence automation

**URL:** <https://discourse.nodered.org/t/sequence-automation/85626>\
**Category:** General\
**Created:** [17 February 2024 21:45 UTC](https://discourse.nodered.org/t/sequence-automation/85626 "2024-02-17T21:45:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FAH2022](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fah2022/32/88357_2.png) [@FAH2022](https://discourse.nodered.org/u/FAH2022)\
**Post date:** [17 February 2024 21:45 UTC](https://discourse.nodered.org/t/sequence-automation/85626/1 "2024-02-17T21:45:04Z")

</div>

Hi all,

I am pretty new and still exploring NR automation approaches. Hope I am right here raising some noob questions?

I want to realize the following light automation:

If night (simple KNX Status) and light 2 is on and afterwards light 3 is turned on, turn light 4 on for 5 minutes and then torn off light 4 again.

For me the order is important, it should not turn on light 4 if first light 3 is on and afterwards light 2 becomes activated.  
Night status should always be the basic requirement for the logic.

How can I realize that?  
Do you have some hints for me?

Thanks in advance

---

<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:** [17 February 2024 21:54 UTC](https://discourse.nodered.org/t/sequence-automation/85626/2 "2024-02-17T21:54:47Z")

</div>

Hi, welcome to the forum.

There are likely a few approaches. Here is one way:

1. store KNX status in flow context variable named "KNXStatus" (use a **change** node)
2. store light 2 status in flow context variable named "light2" (use a **change** node)
3. When new status for "light 3" arrives, use **switch** nodes to check "flow.KNXStatus == night" and "flow.light2 == on"
  - set up a **trigger** node to send "on" then wait 5 mins then send "off"

_NOTE: several assumptions were made since you did not detail what values they are when on/off_

  

If any of that does not make sense to you, then perhaps a little time with the videos will help:

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Additionally, there are example flows for most nodes in `CTRL-I` -\> `examples`

---

<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:** [17 May 2024 21:55 UTC](https://discourse.nodered.org/t/sequence-automation/85626/3 "2024-05-17T21:55:15Z")

</div>

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