Notices not Stopping

Hi Everyone,

I'm new here. Love my HE! I need some help with a rule. I want to use my Google Home to turn on a VS to start a timer to take out our dog every 38 minutes. Everything seems to work fine, but if I turn off the VS because we are going somewhere, when I turn it back on it never seems to stop the repeating actions. So when I turn it back on I'll get a notice in between the new 38 minute period. If I shut it off and turn it on again I'll get another one. Here's my rule:

I've read through all the documentation and have searched these boards but I can't seem to get it to work properly. I don't have a coder mindset, so any help would be appreciated.

Thanks!

Joe

Anyone have any insight on this?

I don't have too many repeats in my rules, so I am going off of the Docs. If this were my rule this is how I would start it.

Trigger: Rosie turns on

Actions:
IF (time between 6:45 AM and 9:30 PM) Repeat Actions every 0:38:0 (stoppable)
  IF (Rosie off) Stop Repeating Actions
  notify Phone and Speak "Let the dog Out" 
END-REP

Each of these IF statements are "Simple Conditional Actions"

I am not sure why your rule is not working but this one should work.
Let me know if it does or doesn't I would love to know if I am doing this right!

This may work but you need the trigger to be If Rosie Changes. If your trigger is Rosie on then your IF for Rosie off will never be true.

Don't really see a problem with OPs original, other than having a trigger for VS on and off, when it could just be when VS changes. I think you could remove the If VS on from your condition in the repeat. It should only get there is it is on.

I have a similar rule that reminds me to stand up at work every 30 minutes. The only real difference is I set a max number of times for the repeat.

It was my understanding that the conditional action for Rosie Off is in the loop it would be re-evaluated every cycle.

From the docs:
Repeat-Until loop:

Repeat Actions with Stop selected
some actions
IF (condition) Stop Repeating Actions
END-REP

EDIT: I just built a quick test for this and a nested conditional is revaluated every loop so this should work with the Trigger set as "Rosie turns on"

image

You are right it would re-evaluate in the Loop

Any updates @Din.Djarin?

Thanks for your help everyone. I think I got it now. Here's my latest changes.

I think some of my problem was also from turning it off/on too fast. Through my testing it seems like I should let it sit a minute before I turn it back on. I'm having fun trying to figure this stuff out, I'm sure for someone with coding experience it's no big deal. Next up I want to try making a scene for my Night Mode.

Turns out I’m still having issues. The notification repeat doesn’t stop if I turn off the VS.

I would try my example above. I think the only thing it doesn’t do that yours is trying to do is turn off the VS at the end. To do this just add a turn off command at the end.

You can pause your script and create this one new so if it doesn’t work as expected you can go back to what you have.

Not sure if this is causing it not to stop, but the first END-IF should be before the END-REP.
Also, you can do without the “First Notice” variable altogether by changing your delay to be slightly less than your repeat duration. If you are repeating every 40 min, and delay the notices by 39 minutes instead of 2 seconds - then the first notice will happen 39 minutes after turning Rosie on, and they will repeat every 40 minutes after that.

Your rule is a lot simpler, but it's not going to run the “stop repeating actions” line until it repeats the next time. That might cause one more notification. Maybe put the notification first, start it with “If Rosie on..” and add a delay. Then after that, if Rosie is OFF stop repeating actions and cancel delayed actions. That might prevent another notification after Rosie is off.

I have tested and the sequence run once more after the switch has turned off but will exit the repeat as soon as the IF statement is evaluated. Which will prevent the notification from happening.

I appreciate your help so I'm sorry if I'm not getting it. Here's what I have right now (copy of my rule set to 3 minutes for testing).

If I turn the VS off everything stops, the problem I'm noticing is that the Scheduled Job never stops so say I stop the VS in the middle of the time period so I can reset it. If I start it back up the previous schedule job never stops. If the VS is in the off state it will go away, but once I start it back up within the period all previous started notification cycles continue.

Here's the logs.

app:10422020-09-10 03:09:18.237 pm info!! BETA Rosie Needs to Potty! copy: Action Repition stopped
app:10422020-09-10 03:09:18.228 pm infoDelay Over: Stop Repeating Actions --> delayed: 0:00:05 (cancelable)
app:10422020-09-10 03:09:13.127 pm infoAction: END-IF
app:10422020-09-10 03:09:13.114 pm infoAction: Stop Repeating Actions --> delayed: 0:00:05 (cancelable)
app:10422020-09-10 03:09:13.080 pm infoAction: Cancel Delayed Actions
app:10422020-09-10 03:09:13.078 pm infoAction: ELSE-IF (Rosie(off) is off(T) [TRUE]) THEN
app:10422020-09-10 03:09:13.058 pm infoAction: END-REP (skipped)
app:10422020-09-10 03:09:13.055 pm infoAction: Notify iPhone: 'Rosie need to potty!' --> delayed: 0:02:59 (cancelable) (skipped)
app:10422020-09-10 03:09:13.050 pm infoAction: Repeat every 0:03:00 (stopable) (skipped)
app:10422020-09-10 03:09:13.047 pm infoAction: Stop Repeating Actions (skipped)
app:10422020-09-10 03:09:13.044 pm infoAction: IF (Rosie(off) is on(F) AND
Time between 6:45 AM EDT and 9:30 PM EDT(T) [FALSE]) THEN (skipping)
app:10422020-09-10 03:09:12.945 pm info!! BETA Rosie Needs to Potty! copy Triggered
app:10422020-09-10 03:09:12.935 pm info!! BETA Rosie Needs to Potty! copy: Rosie switch off
app:10422020-09-10 03:09:10.443 pm infoAction: END-REP (waiting for next)
app:10422020-09-10 03:09:10.429 pm infoAction: Notify iPhone: 'Rosie need to potty!' --> delayed: 0:02:59 (cancelable)
app:10422020-09-10 03:09:10.400 pm info!! BETA Rosie Needs to Potty! copy: Repeating Actions
app:10422020-09-10 03:09:10.386 pm infoAction: Stop Repeating Actions
app:10422020-09-10 03:09:10.383 pm infoAction: IF (Rosie(on) is on(T) AND
Time between 6:45 AM EDT and 9:30 PM EDT(T) [TRUE]) THEN
app:10422020-09-10 03:09:10.314 pm info!! BETA Rosie Needs to Potty! copy Triggered
app:10422020-09-10 03:09:10.301 pm info!! BETA Rosie Needs to Potty! copy: Rosie switch on
app:10422020-09-10 03:09:06.813 pm info!! BETA Rosie Needs to Potty! copy: Action Repition stopped
app:10422020-09-10 03:09:06.803 pm infoDelay Over: Stop Repeating Actions --> delayed: 0:00:05 (cancelable)
app:10422020-09-10 03:09:01.703 pm infoAction: END-IF
app:10422020-09-10 03:09:01.690 pm infoAction: Stop Repeating Actions --> delayed: 0:00:05 (cancelable)
app:10422020-09-10 03:09:01.662 pm infoAction: Cancel Delayed Actions
app:10422020-09-10 03:09:01.659 pm infoAction: ELSE-IF (Rosie(off) is off(T) [TRUE]) THEN
app:10422020-09-10 03:09:01.643 pm infoAction: END-REP (skipped)
app:10422020-09-10 03:09:01.634 pm infoAction: Notify iPhone: 'Rosie need to potty!' --> delayed: 0:02:59 (cancelable) (skipped)
app:10422020-09-10 03:09:01.629 pm infoAction: Repeat every 0:03:00 (stopable) (skipped)
app:10422020-09-10 03:09:01.627 pm infoAction: Stop Repeating Actions (skipped)
app:10422020-09-10 03:09:01.623 pm infoAction: IF (Rosie(off) is on(F) AND
Time between 6:45 AM EDT and 9:30 PM EDT(T) [FALSE]) THEN (skipping)
app:10422020-09-10 03:09:01.560 pm info!! BETA Rosie Needs to Potty! copy Triggered
app:10422020-09-10 03:09:01.549 pm info!! BETA Rosie Needs to Potty! copy: Rosie switch off
app:10422020-09-10 03:08:41.210 pm infoAction: END-REP (waiting for next)
app:10422020-09-10 03:08:41.196 pm infoAction: Notify iPhone: 'Rosie need to potty!' --> delayed: 0:02:59 (cancelable)
app:10422020-09-10 03:08:41.152 pm info!! BETA Rosie Needs to Potty! copy: Repeating Actions
app:10422020-09-10 03:08:41.137 pm infoAction: Stop Repeating Actions
app:10422020-09-10 03:08:41.134 pm infoAction: IF (Rosie(on) is on(T) AND
Time between 6:45 AM EDT and 9:30 PM EDT(T) [TRUE]) THEN
app:10422020-09-10 03:08:41.055 pm info!! BETA Rosie Needs to Potty! copy Triggered
app:10422020-09-10 03:08:41.045 pm info!! BETA Rosie Needs to Potty! copy: Rosie switch on

I will admit once I started looking at a longer loop and turning the switch on and off within the loop time this became MUCH more complicated.

When turn on you want an announcement made to let the dog out after 38 min and every 38 min thereafter. Until the switch is turned off or it is out of a preset time range. If the switch is turned back on you want the repeat time to reset and not pick up where it left off.

I believe this will get it for you.
image

I wanted to break down the logic line by line because it can be hard to follow

  1. Conditional IF for what to do when we get an ON command
  2. IF we are within the time frame Start or continue the loop (this is a "simple conditional" statement)
  3. Do the action that you want repeated with a delay slightly longer than your loop time (1-5 seconds)
  4. End the Loop
  5. This will cancel the delayed action that was created by the loop before the last loop
  6. ELSE-IF What to do when we get an OFF Command
  7. Stop the repeating actions
  8. Cancel any scheduled tasks
  9. Close out the IF statement cleanly.

Thanks for all your help, but it's still not working properly. I copied your example exactly and everything appears to work. But if I turn it off and back on it never cancels out of the while loop. I look in the App Status page and I'll see all the scheduled jobs. I think I'm just going to give up on it for now. I don't want to waste anybody's time. I did find in the forums that this was an issue back in 2018 where the scheduled jobs weren't getting stopped.

Shoot me a screen shot of the rule so I can take a quick look. I love a good challenge!

It works operationally, but if I go to App Status the Scheduled jobs aren't getting canceled.

I think the repeating rule might take one my cycle to clear out of the system (but it shouldn’t perform the actions)

Unfortunately they do. Thanks for your help, I'm just gonna move on for now.