PLEG Washing Machine Alert - Need Help

I’m sure this is pretty basic and I’m just not getting something, but this is my first attempt to do something in PLEG and could use some help. I’ve searched and read through a few different threads about setting up an alert that the washing machine has finished, but can’t quite get it working.

I have an aeon labs smart switch that the washing machine is plugged into. What I’m trying to do is say “if the washer is turned on, and then turns off (below 5 watts for more than 5 minutes), send an alert to my phone”
t_washer_off = energy usage for “washing machine” goes below 5 watts
t_washer_on = energy usage for “washing machine” goes above 20 watts

c_washer_finished = t_washer_on; t_washer_off; (t_washer_off; Now > 5:00)

Send message through VeraAlerts - I’ve verified that I can send / receive the alerts on my phone.

Here’s what I currently see for the status:
t_washer_off, state = true, last true = 2015-04-13 20:53:13, last false = 2015-04-13 20:47:43
t_washer_on, state = false, last true = 2015-04-13 20:46:35, last false 2015-04-13 20:53:13

c_washer_finished, state = null, last true = 0, last false = 2015-04-13 20:53:13

I do have an alert in blue text at the top that lists my condition logic and says “attempt to compare number with nil”

thanks for any guidance

Here’s what else I’ve tried so far w/o much luck

t_washer_off and (t_washer_off; Now > 5:00) - this sends the alert to my phone every minute like i’d expect because its not checking to see if the washer was on first

t_washer_on;(t_washer_off and (t_washer_off; Now > 5:00)) - i see the attempt to compare number with nil message again

t_washer_on and t_washer_off and (t_washer_off;Now > 5:00) - i see this message “Invalid Expression: t_washer_on and t_washer_off and TMP_1 )”

The arguments to a sequence expression can ONLY be inputs or conditions.
These are the only things that have timestamps.

In some of your examples you try to use an arbitrary expression as an argument in the sequence expression …
t_washer_on; t_washer_off; (t_washer_off; Now > 5:00)
This is two sequence expressions … the second one in parenthesis is OK.
The 3rd argument of the first one is an expression … this is INVALID.

Your problem is that you have NOT defined how alerts are supposed to stop …
You can turn off the REPEATS on the condition. (The one that you indicated it does not check for alerts being on).
It will send one alert (at the beginning) and then one alert every time the washer is turned on then turned off.

Or you can limit the number of alerts (Leave Repeats ON):
t_washer_off and (t_washer_off; Now > 5:00 < 10:00)

Thanks for the explanation. I was mis-understanding what “repeats” was used for. With that unchecked it seems to be working the way I want. I need to run a few more wash cycles to make sure my 5 minute delay is enough to not get any premature alerts, but looks good so far.

I ended up with this
c_washer_finished = t_washer_off and (t_washer_off; Now > 5:00)