Why is there no before/after time option for a condition? Why does the day condition require a month?

I've never really tried to create a rule that repeats actions before, and I feel stumped because I don't see an obvious way to do this. I see several ways that feel like workarounds. Very simple rule... my son has been feeling particularly scared of the dark and he wants me to make it so his black light turns on periodically throughout the night to recharge his glow in the dark stars. I want it to repeat every 30 minutes, starting at 10pm.

Well... actually I wanted to build some logic into it so that it starts later if he doesn't have school the next day, and also it should end at either 6 am or an hour before sunrise, whichever comes first. Here's what I currently have.

I had wanted the until to just be "X time or later". There is less potential for problems if I want to change the trigger times. Then I started looking at the conditional options for days.... There is literally one called "On a day". But when you select it, you're required to choose a month and a date. Nothing at all about what day of the week it is. That option should really be renamed to "On a specified day and month" As far as I can tell, there is no conditional action for day of the week, so I can't make an IF statement for "Do this Mon-Fri" and "Do this other thing on Sat/Sun".

Another point.... why has the "Earlier/Later of two times" option that is in Room Lighting not been made available everywhere? Every time there is an "at a time" condition, those two options should be there.

I have literally spent like the last hour trying to figure out something as simple as "Can a rule determine the day of the week" and am stumped. I've been using HE since 2019 (I think) and it's come a long way for sure, but it's frustrating to have such a hard time trying to create what I'd consider a basic rule.

To me, this is a good case to run through AI to get ideas.

I basically told it what you said above, with a few clarifications and a manual override with a virtual switch for special occasions like maybe a sleepover or the kid is away or something.

I made a couple assumptions here about what you meant by school days, and starting later.

1. Prerequisites

  • Virtual Switches:

    • No School Tomorrow: Manually toggle this ON on nights before holidays, snow days, or vacations. This acts as your manual override.

    • Kid Present: Must be ON for the rule to run.

  • Device: Your black light.

2. Rule Configuration: "Glow Star Recharger"

Required Expression (Master Gate)

This ensures the rule never runs unless your son is home.

  • Expression: Kid Present is ON

Triggers

Set these two specific time triggers. The logic inside will decide which one actually activates the light based on the day of the week and the virtual switch.

  • Time: 10:00 PM

  • Time: 11:00 PM

Actions

Use a Conditional Action block to separate "School Nights" from "Weekend/Holiday Nights."

Step 1: Conditional Logic (The Brain) Add a Conditional Action (IF/THEN/ELSE) with the following structure:

  • IF (Any of these are true → It is a "Late Start" night):

    • No School Tomorrow is ON

    • OR Day of Week is Friday

    • OR Day of Week is Saturday

    • AND Current Time is 11:00 PM

    • (Note: This ensures that on Fri/Sat or override days, the rule only proceeds if the trigger is 11 PM. If it triggers at 10 PM on these days, it falls to ELSE and does nothing.)

  • THEN (Start the Loop):

    • Action 1: Turn ON black light.

    • Action 2: Wait 5 minutes (Adjust duration as needed for recharging).

    • Action 3: Turn OFF black light.

    • Action 4: Wait 25 minutes (Completes the 30-minute cycle).

    • Action 5: Repeat Actions 1–4.

      • Repeat Condition: "Until a specific expression becomes true."

      • Stop Expression:

        • (Current Time >= 6:00 AM)

        • OR (Current Time >= (Sunrise Time - 1 hour))

        • OR Kid Present is OFF (Stops immediately if he leaves).

  • ELSE IF (It is a "School Night" → Sun-Thu without override):

    • Condition:

      • No School Tomorrow is OFF

      • AND Day of Week is Sunday through Thursday

      • AND Current Time is 10:00 PM

    • THEN:

      • Run the same Loop (Actions 1–5 listed above).
  • ELSE (Catch-all to prevent accidental runs):

    • Exit Rule (e.g., if it triggers at 10 PM on a Friday, or 11 PM on a Tuesday).

How It Works

  1. Sunday–Thursday Nights:

    • If No School Tomorrow is OFF: The rule waits for 10:00 PM. When triggered, it enters the THEN block (if you structured the IF to check for Fri/Sat/Override first, you might need to swap the logic order slightly, see note below).

    • Correction for simpler logic flow: It is often easier in Rule Machine to check for the Exception first.

    Revised Simpler Logic Structure for the Conditional Action:

    • IF (No School Tomorrow is ON OR Day is Friday OR Day is Saturday):

      • AND Current Time is 11:00 PM:

        • Start Loop.
      • ELSE (It is 10:00 PM on a weekend/override):

        • Exit Rule (Do nothing yet).
    • ELSE (It is Sunday–Thursday and No School Tomorrow is OFF):

      • AND Current Time is 10:00 PM:

        • Start Loop.
      • ELSE (It is 11:00 PM on a school night):

        • Exit Rule (Already ran at 10, or too late).
  2. Manual Override:

    • If you toggle No School Tomorrow ON on a Tuesday night, the rule sees it is an "Exception" day. It will ignore the 10:00 PM trigger and wait for 11:00 PM to start the loop.
  1. I already have a virtual presence sensor for if the kids are here. It is just synced to one of my Google calendars that my ex and I use for scheduling who has them when. I set up a virtual switch already for school days. I subscribe to the school's calendar through Google too.
    • Required expression already done.
    • Trigger already done. I finally figured out that there are more triggers than there are conditionals, and I can use "Day of the week schedule" as the trigger.
    • Several issues with these actions.
      • There is no way to do IF (day == Friday). In the actions, there is no way to check what day of the week it is as far as I can tell.
      • Action 5's stop expression.... RM does not allow you to OR the while statement. But I think you can do IF(Kid presence departed) {STOP REP} before the while conditional if you need more than one way to stop it.

I don't really need help with the logic. And I can think of workarounds. Who cares what day of the week it is for this rule? All that matters really is if he has school tomorrow, because he wakes up earlier and I don't want the black light coming on unexpectedly when he's climbing out of bed or something. I have a way to determine if it's a school night.

It doesn't really change my points about there being no way to check the day of a week in an IF statement in the actions, there should be a condition for before/after a certain time (even if just for the repeat until action. I just wanted to enter an end time for the repeating to stop), and the inconsistencies in selectable times between the various built-in apps.

Thank you though for taking the time to assist. It is appreciated. This community is very helpful.

There absolutely is

Days of week conditional



This is usually handled with "between certain times". A condition of just "before" or just "After" would be very open ended as a condition. Is 23:59 before midnight? or After? Between fixes that. Regardless, I am not sure what you would get from a before or after like you are asking for.

You need a start time for the loop and an end time for the loop. The conditionals suggested work.... not as a workaround, but as actual logic.

If you already have the school days virtual switch, you can use that to replace the If day is portion of the logic.

This becomes if NOT school day AND current time is 11

I haven't thoroughly read through everything in this thread, but for a couple of comments I saw asking like above, try the Date Time parser driver..

You have a lot of stuff in your list that I do not have. Are you using Rule Machine?

I don't understand the confusion. It's after. It's the last minute of the day. 12:00am (midnight) is the first minute of the day, every minute is after midnight. In any case, it wouldn't matter. With a "repeat until time is after 23:59" condition, it would start when triggered and repeat until the next time the clock ticks over from 23:59 to 00:00 and then not repeat again. When using repeat until between two times, it's unclear just from the wording if the loop immediately halts when the first time is reached, or only if the loop tries to run between the two times. I would assume the latter because otherwise the later of the two times wouldn't matter and it would be functionally the same as "repeat until time after". So, for an extreme example that shows the problem I mean, let's say I thought the loop would stop as soon as the time is between 10:00am and 10:02am and I interpret that to mean at 10:01 the repeat will stop and not happen again until the trigger happens. But if the loop repeats every 30 minutes, it'll happen at 10 and then at 10:30, neither of which fall within the time range, so it just keeps repeating at 11, 11:30, etc.

Even if it functionally does the same thing.... there should be a condition that is very clearly worded to mean "Once this time passes, the repeat will end".

They are, but I believe their screenshot is from the conditions management page, which is accessible via the actions page. It's unfortunate that setting up conditions this way offers a different set of options than the conditional action creation/new condition path, but that's the way it is at the moment (and it has been flagged before).

It is after today but before tomorrow, and not specifying the day, or assuming it is implicitly today, leads to confusion.

I thought the suggestion was to restrict the loop to between two times, not to make it stop "between two times".

Like so:

No, it was from setting up the conditional action -> Using "New Condition" since I did not have any conditions in a blank rule. But, the screenshot was from a first action of "conditional action" -> If condition then

Repeat While condition? (PS - If you use the second photo, don't forget the final EndRep at the end)


I can do that... but I still need to specify a start time. The goal is to, as some point, move it away from starting at a preset time and wrapping it up into a more general "Kids Bedtime" scene. At my new house, I don't have much setup yet so this is literally the first part being added. The scene being triggered is what will trigger this rule (probably with a 1 hour or so delay) and start the loop, eventually. I just want it to repeat when triggered and have a set end time for the repeating. So I do want a do-while loop and not just a while loop.

OMG! I never knew this had different options. Why on Earth would that be the case? Knowing that, adding the condition there and then adding it to the rule is a piece of cake. I need to poke around in there and see what else might be missing when adding it from the new action screen. So now it just triggers at 9:30 and just waits an hour to start repeating if it's not a school night. Still need to finish setting that up, but that can come next.

Well, I got the rule setup how I want it. I still believe there should have been a much simpler way to accomplish this.

If your start time is the same as your earliest trigger time, it will always be true for the do while loop.

I thought you had a calendar link that activated a virtual switch to say if it was/was not a school day. If so, you don't need days of the week. You can just use evaluation of the school day. What are you doing for Sun through Thurs when it isn't a school day?

Looks like your rule works for you, albeit a bit more complicated than it needed to be.
So I am reading the logic,
You set the date to today
Set the time to 5:30 AM
Then set the time to 24 hours later than the previously set time

If it is a weekend, you set the time again to an additional 23 hours longer. I am thinking you are losing something here. It looks like you already had it set for tomorrow at 5:30 AM and then change it to sunrise. I think that is date agnostic, and just sets it for 7 AM tomorrow since that was the date it already was, then adds another 23 hours. Then wait for 10:30

When that is done, it will start the loop of
Light on
wait 30 seconds
light off
Check current time
Evaluate the difference
Loop end when the difference is 0

YOu could get the same with a similar set up to what I showed

Required Condition = Kids Present

Trigger 1: 9:30 PM
Trigger 2: 10:30 PM

Actions:
conditional if school day(night) is true
Do while time between 9:30 and 5:30 AM, repeating every 30
On Light
wait 30 seconds
Off Light
End Rep
Else if , conditional if school day(night) is false
Do while time between 10:30 and Sunrise - 60, repeating every 30
On Light
wait 30 seconds
Off Light
End Rep

When you do set time it only changes the time, not the date. It's a little confusing because I ran the actions to test it, so the screenshot is showing the current value of the variable. So it shows 5:30am tomorrow there because I had already run the action and it was set correctly.

Here is the value of EndTime after running the first action:

image

Second action:

image

Third action:

image

I have to do it as separate actions because if you choose set date and time, you have to enter a specific date. There is no built in "tomorrow". Also, none of the set actions allow you to specify an offset. So you have to get the current date, then set the time you want on some other date, and then offset it by however many days you want.

Another issue is that sunrise time doesn't recalculate until after midnight. I want it to stop an hour before sunrise so I set the endtime to the current sunrise time for today and add 23 hours to it. It'll be off by a couple of minutes technically but it doesn't matter.

Here is the value of EndTime after running the action that sets it to sunrise + 1380 minutes:

image

So your do while loop wouldn't work because when it starts, sunrise - 60 happened over half a day ago. I also don't have to duplicate the loop this way either.

I have the calendar and a virtual switch, but I still need to configure the Gcal search app and get it set up. I wanted something that will work now that I can simply swap out a conditional statement once I get it setup and tested and I have something that I know works in the meantime.