# Sunrise/Sunset

**URL:** <https://community.homey.app/t/sunrise-sunset/136502>\
**Category:** Questions & Help\
**Created:** [May 14, 2025, 4:34pm UTC](https://community.homey.app/t/sunrise-sunset/136502 "2025-05-14T16:34:47Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luigi\_Colancecco](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/luigi_colancecco/32/82268_2.png) [@Luigi\_Colancecco](https://community.homey.app/u/Luigi_Colancecco)\
**Post date:** [May 14, 2025, 4:34pm UTC](https://community.homey.app/t/sunrise-sunset/136502/1 "2025-05-14T16:34:47Z")

</div>

So, I know why this doesn’t work (because it only runs once, and if that’s not at the right time it won’t do anything).  
But how can I make this work?

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/6/a603a64d33d919495cb6c79be33f4dcfc797a35d.png)

---

<div class="post-metadata">

**Author:** ![Theo\_de\_Koning](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/theo_de_koning/32/136062_2.png) [@Theo\_de\_Koning](https://community.homey.app/u/Theo_de_Koning)\
**Post date:** [May 14, 2025, 4:41pm UTC](https://community.homey.app/t/sunrise-sunset/136502/2 "2025-05-14T16:41:18Z")

</div>

First: what do you _want_ to do?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [May 14, 2025, 5:32pm UTC](https://community.homey.app/t/sunrise-sunset/136502/3 "2025-05-14T17:32:34Z")

</div>

To discover what it does(n’t) do, I suggest to add notification or log cards to all possible points in your flows.  
Like the red cards in this example flow:

 ![Screenshot from 2025-01-27 13-12-23](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/7/f7025c540e43c2c8278ea97e3e9519b81b887f55.png)  
(and add the flow name in these kind of cards 😉 )

---

<div class="post-metadata">

**Author:** ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)\
**Post date:** [May 14, 2025, 5:59pm UTC](https://community.homey.app/t/sunrise-sunset/136502/4 "2025-05-14T17:59:57Z")

</div>

Today the sun rises at 5:51 in Rome.  
That is before 6:00. So the flow stops here.

---

<div class="post-metadata">

**Author:** ![DirkH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkh/32/78952_2.png) [@DirkH](https://community.homey.app/u/DirkH)\
**Post date:** [May 15, 2025, 11:16pm UTC](https://community.homey.app/t/sunrise-sunset/136502/5 "2025-05-15T23:16:47Z")

</div>

Hi @Luigi_Colancecco ,  
the flow will work perfectly on most homes.  
As soon as the sun rises  
if it is a workday and after 6:00h then set variable to 1  
(else, if sun rises before 6 am do nothing)  
if it is workend and after 8:00h then set variable to 2  
(else, if sun rises before 8 am do nothing)  
So obviously the variable is only set in autumn and winter.  
If you want to get the variables set also in spring and summer, you need to adapt this multi condition test flow to your needs

 ![MultiCondition Test](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/9/492fc873611952e01007393ab0be78bb1b947320.png)  
add to your triggers the one  
When it is 6:00h  
When it is 8:00h  
and add the relevant AND conditions  
Have fun  
Dirk

---

<div class="post-metadata">

**Author:** ![Luigi\_Colancecco](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/luigi_colancecco/32/82268_2.png) [@Luigi\_Colancecco](https://community.homey.app/u/Luigi_Colancecco)\
**Post date:** [May 16, 2025, 4:20pm UTC](https://community.homey.app/t/sunrise-sunset/136502/6 "2025-05-16T16:20:42Z")

</div>

So I got it to work like I want it to (I’m pretty sure lol)  
But how can I simplify this?  
FYI you can disregard the MODES: variable, as that’s just what I use to turn on/off pretty much everything in my house  
@DirkH I will try this

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/a/ea77a2612914418f881397231bfa38bfc3df44bf.jpeg)

---

<div class="post-metadata">

**Author:** ![Luigi\_Colancecco](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/luigi_colancecco/32/82268_2.png) [@Luigi\_Colancecco](https://community.homey.app/u/Luigi_Colancecco)\
**Post date:** [May 16, 2025, 4:37pm UTC](https://community.homey.app/t/sunrise-sunset/136502/7 "2025-05-16T16:37:42Z")

</div>

I’m basically creating an AOI, or “Add On Instruction”  
I want to create a set “routine” that changes a variable that I could place anywhere, in any flow, which executes a number of cards so I don’t have to keep recreating the same group of cards over and over again, just like you would do with the industrial Allen Bradley logix5000 logic, or as close to it as I could get.  
In this particular “AOI” I want to use the Sunrise/Sunset Variable.  
\*WHEN the sunrises AND it’s a weekday AND it’s later than 6:00am THEN set variable to 1, if  
not, set it to 2  
\*WHEN the sun rises AND it’s a weekend day AND it’s later then 8:00am THEN set variable to  
1, if not then set it to 2  
\*WHEN the sunsets, change variable to 2 regardless of anything else  
This way, instead of repeating all those cards over and over, I could just use the Sunrise/Sunset variable, does that make sens?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [May 16, 2025, 7:47pm UTC](https://community.homey.app/t/sunrise-sunset/136502/8 "2025-05-16T19:47:16Z")

</div>

Ah, a puzzle!

It can be simplified indeed;  
“Twin” triggers and conditions can be “undoubled” like this

 ![1000048921](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/e/9e867e63fb97c39656943218db086ae4fe669aa3.png)

Next to the “true” output (blue), the weekday cards have a “not true” output (orange), which eliminates the use for the weekend conditions:

 ![image8l99](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/b/5bfa989554e830c23c5b6762cb0bb2ba47204c1d.png)

The second (from top to bottom) “after sunrise” condition is identical to the first one, so it may go. Just like the weekday condition, both true or false starts the exact same “after sunrise” condition flow cards:

 ![image100](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/4/5/4510ddd770a320062b23fa2a4b29349e86e17855.png)

But, sometimes it’s easier to “read” a flow when it’s not stripped down to the absolute minumum of needed cards.  
Or you could add notes, to clarify stuff for yourself.  
I’ve managed to make some flows I had a hard time to “decrypt” again later on 🤣

---

<div class="post-metadata">

**Author:** ![Theo\_de\_Koning](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/theo_de_koning/32/136062_2.png) [@Theo\_de\_Koning](https://community.homey.app/u/Theo_de_Koning)\
**Post date:** [May 16, 2025, 8:34pm UTC](https://community.homey.app/t/sunrise-sunset/136502/9 "2025-05-16T20:34:58Z")

</div>

By the 2nd optie.

Parallel to the “Time is 06:00” cart to bring back the “Time is 08:00”. (also to the top #MODES cart)  
Because otherwise the “Weekend” get no time start.

1st block is _time_ the trigger and is _sunrise_ 2nd factor.  
2nd block is _sunrise_ the trigger and is _time_ 2nd factor.

---

<div class="post-metadata">

**Author:** ![DirkH](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkh/32/78952_2.png) [@DirkH](https://community.homey.app/u/DirkH)\
**Post date:** [May 17, 2025, 1:57pm UTC](https://community.homey.app/t/sunrise-sunset/136502/10 "2025-05-17T13:57:58Z")

</div>

> [@Luigi\_Colancecco](#):
>
> I will try this

That is really OK.  
It is straight forward and it is easy to avoid mistakes.  
Only in case you have to change something later you have to do it 4 times. But using the Sunrise/Sunset variable and trigger other flows by this variable is a good solution.

---

<div class="post-metadata">

**Author:** ![Luigi\_Colancecco](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/luigi_colancecco/32/82268_2.png) [@Luigi\_Colancecco](https://community.homey.app/u/Luigi_Colancecco)\
**Post date:** [May 21, 2025, 4:11pm UTC](https://community.homey.app/t/sunrise-sunset/136502/11 "2025-05-21T16:11:06Z")

</div>

So, thank you for everyone’s input! This is what I came up with after reading all of your posts, and I think it should work just fine!  
I just realized this still won’t work 🫤  
All I want, is:  
A. The Sunrise/Sunset bit to flip to 1 when the sun rises, and 2 conditions need to be true.  
1. It’s after 6:00am on a weekday  
2. It’s after 8:00am on a weekend  
B. The Sunrise/Sunset bit to flip to 2 when the sun sets.  
I feel like this shouldn’t be that difficult lol!  
Is there a way I could have it “wait” for the sun to rise?

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/c/dc1630703892c5a79c8fa138280f0b0e53a14ad9.png)

---

<div class="post-metadata">

**Author:** ![Luigi\_Colancecco](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/luigi_colancecco/32/82268_2.png) [@Luigi\_Colancecco](https://community.homey.app/u/Luigi_Colancecco)\
**Post date:** [May 21, 2025, 4:47pm UTC](https://community.homey.app/t/sunrise-sunset/136502/12 "2025-05-21T16:47:38Z")

</div>

I think I may have gotten it this time!

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/a/e/aedd544b35c77c51e1dbd344dc46dda4ee8abb18.png)

---

<div class="post-metadata">

**Author:** ![Wim\_Post](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/wim_post/32/56793_2.png) [@Wim\_Post](https://community.homey.app/u/Wim_Post)\
**Post date:** [May 21, 2025, 8:17pm UTC](https://community.homey.app/t/sunrise-sunset/136502/13 "2025-05-21T20:17:21Z")

</div>

I think you want to remove the yellow lines. Now the flow continues no matter what the value of ‘sunset/sunrise’ is.

 ![IMG_1942](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/5/a/5aa44f47214c7af43569b80d8363bce929edecd4.jpeg)  
If “sunrise/sunset’ is exactly 3 is true the blue line sets ‘sunrise/sunset’ to 1  
If ‘sunrise/sunset’ is exactly 3 is NOT true the yellow line sets ‘sunrise/sunset’ to 1  
So is doesn’t matter what the value of ‘sunrise/sunset’ is it will be set to 1

---

<div class="post-metadata">

**Author:** ![Luigi\_Colancecco](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/luigi_colancecco/32/82268_2.png) [@Luigi\_Colancecco](https://community.homey.app/u/Luigi_Colancecco)\
**Post date:** [May 28, 2025, 4:36pm UTC](https://community.homey.app/t/sunrise-sunset/136502/15 "2025-05-28T16:36:25Z")

</div>

OK, I think (Hope) this is “THE ONE!”

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/0/602a3a3b42b3ec6c8943e9c513e7f665520ab069.png)
