Rule 4.1 structure help...am I missing something?

Wrote this rule to turn the TV off after the kids spend 30 minutes watching something. Rule Machine is prompting me for an ELSE or an END-IF, but I don't see that I need either. Am I missing something?

Well you've only endif'ed one if block. I guess you need to close the outer if block.

One thing you may want to think about is if the kids started watching the TV at 4:31pm, whether your logic would still hold...

I am thinking you may be able to use some of the wait / delay options a little more to avoid needing to use some of the conditional logic and counters for time like you are.... But can't claim to be an expert in how best to implement it.... But am happy to take a wild stab... :slight_smile:

As an alternative, what about:

Rule # 1

Predicate:
Time between 3pm-5pm

Trigger:
Living Room Roku transportStatus playing

Action:
Wait for event -> elapsed time 25 mins - Announce "Only 5 minutes of TV Time remain..." - Cancellable
Wait for event -> elapsed time 5 Mins - Announce "TV Time is over" - Cancellable
Run Rule # 2

Rule # 2

Trigger: Time at 5pm

IF Living Room Roku transportStatus playing THEN
Cancel actions in Rule # 1
Announce "TV Time is over"
wait 10 secs...
pause()...
wait 3 secs...
home()...
END-IF

Simon

Only the last IF is an IF-THEN, the rest are simple conditionals and should not need an END-IF. Not even sure where I would insert another END-IF properly.

It may be just the way it's formatted(indented) but it looked to me like there was one If block nested inside an outer If block, which would make me want to stick an Endif right at the end as the final line after the end-rep to close the outer If

Thanks for the options. I'm relatively certain (hopeful) that the logic will do what I want. It's meant to limit the total amount of TV watching time to 30 minutes during the time after they get home from school and before my wife or I get home. The time they turn the TV on varies based on how many chores they have that day and how much effort they put in. And sometimes they argue for a while on what to watch next, so I'm being generous (for the moment) and not counting that time (transportStatus NOT playing) .

1 Like

Whatever the flaw in my syntax might be, the logic worked as expected. It was hilarious to watch my son try to keep watching and the automation keep exiting the app. WAF is very high... we were both laughing out load as we watched him struggle.