PLEG & Timing

I want to send a text message when the washing machine is done. To do that, I installed a z-wave energy monitor and I plan to use PLEG for checking the conditions to send that text message. The issue is that the washing machine goes through cycles where the energy level can drop to standby. So I need to have some logic that goes like this:

  1. If the wattage goes above 20W then the washing machine started.
  2. Once started, when the power goes below 20W for more than 2 minutes then send a text message

Note that all power dips below 20W that are less than 2 minutes should be ignored because that is just a pause from one cycle to the next cycle.

How do I implement this logic with PLEG. Screenshots of a setup, tutorial for a similar scenario, etc would be appreciated.

Have you read the PLEG Basics manual first? Have you installed PLEG and got it setup? Do you know how to use triggers, conditions and actions?

Only reason I ask is since your asking for screen shots seems like we need to start from the beginning.

Most will be more then happy to help make corrections or come up with a condition, just post the status report in PDF format is the normal protcall.

Thanks. I have installed PLEG and read the documentation at Program Logic Event Generator - Vera Plugin

Here is what I have done so far:

Input:
Less_Than_20W = Energy usage for Energy Monitor #2 goes below 20 Watts
More_Than_20W = Energy usage for Energy Monitor #2 goes above 20 Watts

Conditions:
c1 = More_Than_20W;(Less_Than_20W;Now > 2:00)
also tried c1 = More_Than_20W and (Less_Than_20W;Now > 2:00)

Notifications:
Washing Machine Is Done = Washing Machine Done has satisfied condition: c1, Notify: …

I am testing this using a heater that I turn on and off making sure that in vera I can see the change of the wattage being used (there is some delay as it seems it polls maybe every 30s). Since the last post I also checked out the “Status”. Interestingly, my “More_Than_20W” has both “Last True” and “Last False” set to 0, hence it was never triggered. Also the Last True for Less_Than_20W is some hours ago. It almost seems this is not updated for some reason.

Also frankly I don’t quite understand how the conditions work as the documentation does not seem to describe it. For instance one example says “(Motion1;MainDoor) AND (Motion2;MainDoor)…”. The description says the Motion1 happened before MainDoor, etc. Based on that, it appears to me that the semicolon defines triggers that must happen in the defined sequence (first Motion1 followed by MainDoor). So in my example with the washing machine it means first I must get the trigger “More_Than_20W”, then the trigger “Less_Than_20W” and that status must stay like that for at least 2 minutes.

I created a scene to send me a notification if the wattage goes above 20W. The only purpose for this was to see if there is an issue with the energy meter. Everything worked as expected and interestingly enough, now also the status on the PLEG updated without me having made any other changes to PLEG. Not only did the status update but I also got a notification from PLEG.

With this now working I modified my conditions to c1 = More_Than_20W;Less_Than_20W;Now > 2:00. This actually seems to work as intended but I need to do some more testing.

On another note, I got some blue error message on top of the vera website which is why I modified the condition. However, the error message later on still showed the same old code. I clicked on “Reload Luup” which seems to update the code for the condition. Earlier, I had a similar issue with changing the device for the triggers. I could not just edit it as it switched back to the old device. So I ended up deleting the trigger and recreating it.

Also frankly I don't quite understand how the conditions work as the documentation does not seem to describe it.

Have a look at PLEG Basics.

Your current scheme using a Sequence Expression with Now may not give you what you want. You may be better using:

c1 Less_Than_20W and (Less_Than_20W;Now > 2:00)

You could also use a SelfReTrigger timer (Schedule) to time the two minutes. This is covered in the above guide.

It looks like that is a nice documentation. A link to this documentation should be provided on the rts-services.com website. I’ll be studying this document. Thanks!