Having trouble setting loop


#1

1) Give a description of the problem
I have a piston that reminds my son about bedtime. The parts that notify him at certain times work, but my new loop keeps repeating immediately instead of waiting.

2) What is the expected behavior?
Time notifications, and then check light status on a loop until he turns down his lights for bedtime.

3) What is happening/not happening?
The lights change, but the spoken notification repeats over itself instead of waiting 2 minutes. It also doesn’t run unless I press the TEST button.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)

(I changed the time setting to current so it would run)

12/19/2018, 11:41:25 AM +793ms
+1ms ╔Starting piston… (v0.3.109.20181207)
+1021ms ║╔Subscribing to devices…
+1364ms ║║Subscribing to Echo - Derek Echo…
+1365ms ║║Subscribing to Echo - Computer Echo…
+1367ms ║║Subscribing to Computer Light…
+1368ms ║║Subscribing to Derek Light 1…
+1370ms ║║Subscribing to Derek Light 2…
+1372ms ║║Subscribing to Couch Light Bottom…
+1373ms ║╚Finished subscribing (370ms)
+1493ms ║Comparison (time) 42087265 is_between (time) 42000000 … (time) 42600000 = true (17ms)
+1496ms ║Time restriction check passed
+1499ms ║Cancelling condition #69’s schedules…
+1522ms ║Comparison (integer) 100 is_greater_than (integer) 50 = true (2ms)
+1524ms ║Cancelling condition #72’s schedules…
+1555ms ║Cancelling condition #71’s schedules…
+1570ms ║Setting up scheduled job for Wed, Dec 19 2018 @ 9:45:00 PM PST (in 36212.639s), with 1 more job pending
+1584ms ╚Piston successfully started (1583ms)


#2

You need to remove the asynch in your while loop. Asynch executes all the tasks in the statement at the same time which is why it’s talking over itself.

Aslo, regarding the statement only executing when you press Test, that’s due to not having a trigger. If you have a motion sensor in the room, you can incorporate that in that part of the statement. Something like below…

while
  ( motion is active
  and
  time is between XX and YY
  and
  Any of bulb1 or bulb2's level is greater than 50% )
  when true
    tasks
end while

#3

But I’m sending two different notifications to two different speakers. Then again, ES occasionally repeats itself.

I’ll work on the trigger.

[EDIT] Hmmmm…the quote shows correctly in my preview, but not in the post…

[EDIT] Nvrmnd…it fixed itself