Rule Machine 4.0 Script Input

I may not have had enough coffee, but this is script not working and I am not sure why, any suggestions?

Thank You As Always
Matt

IF (Day in Monday, Tuesday, Wednesday, Thursday, Friday(T) AND
Time is 6:25 AM CDT(F) [FALSE]) THEN
On: Tristen TV
ELSE-IF (Day in Monday, Tuesday, Wednesday, Thursday, Friday(T) AND
Time is 6:55 AM CDT(F) [FALSE]) THEN
Off: Tristen TV
ELSE-IF (Day in Monday, Tuesday, Wednesday, Thursday, Sunday(T) AND
Time is 10:30 PM CDT(F) [FALSE]) THEN
ELSE-IF (Day in Friday, Saturday(F) AND
Time is 11:30 PM CDT(F) [FALSE]) THEN
Off: Tristen TV
END-IF

Triggers:
On Mon, Tue, Wed, Thu, Fri at 6:25 AM CDT
On Mon, Tue, Wed, Thu, Fri at 10:30 PM CDT
On Sun, Sat at 11:30 PM CDT
On Mon, Tue, Wed, Thu, Fri at 6:55 AM CDT

What do you want it to do? Can you describe what is wrong or what the script is not doing? Otherwise it would be very tough to help

Well, it is not turning the TV switch on at the specified times.

Thanks

Yes,

your problem is that you check for a very specific time and not for a time range.
So, you trigger is 6:25 AM, or more specifically, it is at 6:25:00.000 AM (seconds and milliseconds).
Now you are checking in your if rule if the time is = 6:25:00.000 AM, however, a millisecond here or there might have passed for processing, so by the time you reach your first IF the time is actually 6:25:00.123 AM and the comparison you do is not TRUE anymore.

When using time in IFs, it is always advised to use "time in between" to accommodate processing times.
So I would change you rules to:

IF (Day in Monday, Tuesday, Wednesday, Thursday, Friday(T) AND
Time is between 6:25 AM CDT and 6:27 AM CDT) THEN
....
ELSE IF ELSE-IF (Day in Monday, Tuesday, Wednesday, Thursday, Friday(T) AND
Time is between 6:55 AM CDT AND 6:57 AM CDT) THEN
...
ELSE-IF (Day in Monday, Tuesday, Wednesday, Thursday, Sunday(T) AND
Time is between 10:30 PM CDT(F) and 10:32 PM CDT) THEN
.... <- BTW you are missing a statement here so you last ELSE-IF wouldn't fire as you want to
ELSE-IF (Day in Friday, Saturday(F) AND
Time is 11:30 PM CDT and 11:32 PM CDT) THEN
...
END IF

Thank you so much, I will test this today :smile:

Question: What is the average time window that is safe but as small as possible for everything to trigger?

Question: Do you have to define triggers for times, since a time range is not allowed as a trigger?

Thanks Again
Matt

Give it a minute or two and you should be ok

No, triggers happen at a given time and not for a range of time.

OK, thank you. If no triggers happen at a certain time, then why is it an available trigger field to define?

Thanks
Matt

Triggers happen at a certain time. I might have misunderstood your question. Triggers always happen at a certain time or event

OK Thanks, I am just getting up too speed (day 2 on Hubitat) :slight_smile:

Welcome aboard and enjoy the ride, it is a fun one!

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