# Creating a flow to divide a day in several time slots, or scheduling app

**URL:** <https://community.homey.app/t/creating-a-flow-to-divide-a-day-in-several-time-slots-or-scheduling-app/11998>\
**Category:** Questions & Help\
**Tags:** flow\
**Created:** [April 17, 2019, 9:38pm UTC](https://community.homey.app/t/creating-a-flow-to-divide-a-day-in-several-time-slots-or-scheduling-app/11998 "2019-04-17T21:38:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jumanji](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jumanji/32/9117_2.png) [@Jumanji](https://community.homey.app/u/Jumanji)\
**Post date:** [April 17, 2019, 9:38pm UTC](https://community.homey.app/t/creating-a-flow-to-divide-a-day-in-several-time-slots-or-scheduling-app/11998/1 "2019-04-17T21:38:35Z")

</div>

I’d like build a flow that divides a 24 h in several time slots, eg. for 3 slots

1. 00 01–0800
2. 0801-- 1600
3. 1601- 00 00 hours

The current flow editor allows me to set only 2 slots with the `Time is between` card in the AND branch and the ‘rest’ in ELSE branch.

Headlong solution would be to let ELSE section start another flow that will further create flows for slots 2 and 3.

How do you build a flow (or as few flows as possible) to achieve this? Or perhaps some kind of scheduling app.

PS I also really miss an IF condition in the THEN section…

---

<div class="post-metadata">

**Author:** ![Dijker](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dijker](https://community.homey.app/u/Dijker)\
**Post date:** [April 17, 2019, 10:17pm UTC](https://community.homey.app/t/creating-a-flow-to-divide-a-day-in-several-time-slots-or-scheduling-app/11998/2 "2019-04-17T22:17:41Z")

</div>

Did you look at the solution provided here by @AVP?  
Guess it does What you want,  
Read it here:

> [@Create a scheduler for morning, day, evening and night time](https://community.homey.app/t/create-a-scheduler-for-morning-day-evening-and-night-time/11698):
>
> As I have not found any scheduler (besides for heating control) I have made a flow-based scheduler for the purpose of setting different actions in different time ranges depending of the day type week day, weekend and bank holiday. The scheduler is consisting of 9 flows in total. For week days I have created four flows to determine if it is morning, day, evening or night. The same four flows I have made for weekends/bank holidays but with different time ranges. At least there’s a flow to determi…

And you can Start a 2nd flow from an Else …  
And I guess I have here a Flow with 3 Time-slots (yes, that is the simple max) that starts a 2nd Flow in the Else like you ask…

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/2X/5/50f20db62e6bdd2360a32cf957f355229d68af38.jpeg)

And Yes a If statement in the Then selection is not possible, you should move then to the Conditions, that looks the same to me unles you want to Execute ActionA and If (SomeOtherCondition) Execute ActionB  
but then the Start a Flow would work…  
That (multiple flows) also is the way to differentiate for 3 timeslots, as with one If condition you cant have 3 outcomes… a Condition is simple true or false… But imho differentiating beween the 3 timeslots should be done with 2 casceded flows both with one condition:

> Flow1 is started, And Time Before 8u00 Then Action1 Else Start Flow2  
> Flow2 is started And Time Before 16u00 Then Action2 Else Action3

---

<div class="post-metadata">

**Author:** ![Jumanji](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/jumanji/32/9117_2.png) [@Jumanji](https://community.homey.app/u/Jumanji)\
**Post date:** [May 1, 2019, 6:22am UTC](https://community.homey.app/t/creating-a-flow-to-divide-a-day-in-several-time-slots-or-scheduling-app/11998/3 "2019-05-01T06:22:01Z")

</div>

Thanks, I manage to implement it as discussed here.  
Have made flows to set Time of day variable (day evening night). It saved mind from wrapping it around the time ranges and can be used in other flows.

```
Then two flows to branch the logic
    1. If evening :
     Then Start timer
      Else 1.1

    1.1 If night:
            Then Start timer`

```

And finally the flow to react on the timer reaching zero and turning the lights off.  
All in all lots of flows, but the logic is controlling two motion sensors and two different lights therefore it is quite acceptable.

I do miss condition in the else branch thought, even if it’s simple if, it would save flows from growing in numbers like now.
