# Homey flow cards & logic outside lights

**URL:** <https://community.homey.app/t/homey-flow-cards-logic-outside-lights/91260>\
**Category:** Flows\
**Created:** [October 8, 2023, 8:47am UTC](https://community.homey.app/t/homey-flow-cards-logic-outside-lights/91260 "2023-10-08T08:47:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crapton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/crapton/32/15039_2.png) [@Crapton](https://community.homey.app/u/Crapton)\
**Post date:** [October 8, 2023, 8:47am UTC](https://community.homey.app/t/homey-flow-cards-logic-outside-lights/91260/1 "2023-10-08T08:47:31Z")

</div>

All, I have a Homey for years but not worked much with flows so a newby. I have 2 questions:

1. Using standard flow in the “If” statement it appears only a subset of cards is available for several functions in apps and system. When going to “Then” there are many more cards. Example: new flow → If (date & time) there is no card stating “it is night”. So why can I not create: “If it is night” then … etc. “It is night” is available in the “and” statement. What am I missing here?

2. I have made a very simple flow for a Shelly device:  
If Shelly is off  
And time not between 23:00-06:00 & it is night  
Then Shelly switch on

I was expecting it to switch back on at 6:00, after which another flow will switch it of during the day. **However it does not switch back on at 6:00.** Sunrise at my location today is 07:54, twilight 06:03.

If I run the flow by hand it switches on. What am I doing wrong? Is Homey no supposed to check flow conditions all the time and in this case if true switch on? Or is “night” going from twilight to twilight and 6:00 was just too late to switch back on? I should use the “Zonnestanden” app for more accuracy?

 ![Night light on](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/d/0d071b29e3f1744f995c802a466ee9cb1595b7cd.jpeg)

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 8, 2023, 9:10am UTC](https://community.homey.app/t/homey-flow-cards-logic-outside-lights/91260/2 "2023-10-08T09:10:13Z")

</div>

> [@Crapton](#):
>
> What am I missing here?

Flows get triggered by _events_, and “It is night” is not an event, it’s a state.

> [@](#):
>
> If Shelly is off

No, the flow says “WHEN Shelly IS TURNED off”. That’s an event.

You need to split your flow into several flows:

1. 
  - WHEN “nighttime starts”
  - AND Shelly is off
  - AND it’s before 23:00
  - THEN turn on Shelly

2. 
  - WHEN it’s 23:00
  - AND Shelly is on
  - THEN turn off Shelly

3. 
  - WHEN it’s 6:00
  - AND Shelly is off
  - AND it’s nighttime
  - THEN turn on Shelly

The “nighttime starts” card does’t exist on Homey, you can either use “WHEN the sun sets in 0 minutes” or (more accurate) use the Zonnestanden app.

It might also be possible to create a single flow if you let it run every (say) 10 minutes or so:

- WHEN Every 10 minutes
- AND Shelly is off
- AND it’s nighttime
- AND the time is NOT between 23:00 and 06:00
- THEN turn on Shelly

---

<div class="post-metadata">

**Author:** ![Crapton](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/crapton/32/15039_2.png) [@Crapton](https://community.homey.app/u/Crapton)\
**Post date:** [October 8, 2023, 2:57pm UTC](https://community.homey.app/t/homey-flow-cards-logic-outside-lights/91260/3 "2023-10-08T14:57:21Z")

</div>

Ah very helpful answer, thanks for that! Explains a lot, also why not all cards are available in the WHEN statement.

I like your last suggestion and I had already considered something like that, since my original flow appeared to work when I did run it manually. Will implement this change!
