Using consumption to detect when finished using PLEG?

Hi Richard,

Today I have a 2 combination switches and 1 virtual switch to be able to detect if our washing machine is finished.

Consumption >50 W AND VSwitch Off => VSwitch On
Consumption <5 W AND VSwitch On => VSwitch Off

When machine is finished I have a scene trigger on VSwitch off that tells us in the Sonos speakers.

Do you think it would be possible to create a PLEG device that does this using one device?

Maybe easier to use this “Energy Metering Sensor plugin”
http://forum.micasaverde.com/index.php/topic,11076.0.html

[quote=“hek, post:1, topic:174723”]Hi Richard,

Today I have a 2 combination switches and 1 virtual switch to be able to detect if our washing machine is finished.

Consumption >50 W AND VSwitch Off => VSwitch On
Consumption <5 W AND VSwitch On => VSwitch Off

When machine is finished I have a scene trigger on VSwitch off that tells us in the Sonos speakers.

Do you think it would be possible to create a PLEG device that does this using one device?[/quote]

This seems to be so simple that I wonder if I’m missing something…

Inputs, Triggers
WMOff - WM Consumption < 5

Conditions
WMDone - WMOff

Actions

The condition WMDone will fire (be satisfied) when WMOff becomes true (meaning it was previously false). You can add a PLEG action for this or have your scene triggered by the PLEG condition WMDone being satisfied.

You need to find something else for this PLEG instance to do otherwise it’s a waste of the 2MB memory space. :slight_smile:

I think the following PLEG will do it:
PLEG Input Property:
WMPower: bound to Washing Machine Power Consumption

PLEG Condition:
        WMRunning:   WMPower > 50
        WMStop: WMPower < 5
        WMNotify:      WMRunning; WMStop;
 PLEG Action:
        WMNotify:    Sonos Say Command

I assume there is an advanced command for Sonos to Say a string. I have not followed Sonos details.
[hr]
If you use one PLEG in place of two combination switches you will save 2MB of Vera Memory.
But as @RexBeckett has indicated … once you have a PLEG device you can put other logic in there … to save memory.

This is my first try try with your excellent plugin. Really clean and nice solution. Thank you.

Yes sonos say actions are simple to call - no problem.

Hi, i’ve been struggeling with this relatively simple scenario for a while now.

WMNotify: WMRunning; WMStop;

Does not work at all. I can see in the logs that VMRunning is beeing activated but VMNotify never seems to be activated when consuption goes below 4W.

When doing
WMNotify: Consumption < 4

It works… but I really need it to go above a certain conusuption (>50W) to be sure the machine is really in a running state. Othervice the scene gets triggered multiple times during washing machine startup.

Could it be some PLEG problem reading the same variable and looking at a condition like this “WMRunning; WMStop”. Should I introduce the NOW notation?

I’m rather lost here.

I can see in the logs that VMRunning is beeing activated
What about WMStop? Does that appear in the log? How often does the consumption variable get updated? We could probably help more if you post the report from your PLEG.

Here we go…

Schedules
Name Type Time Days

Device Properties
Name Device Name Device Variable
power Tv?ttmaskin Watts
testWatt K?ksbordet Watts

Conditions
Name Expression
ended testWatt<4
started testWatt>50
finished started;ended

Actions

Actions for Condition: notify
Device Action Arguments
VeraAlerts SendAlert Message=Hello WM done! Recipients=
Sonos K?k Say Text=Tv?ttmaskinen verkar vara f?rdig! Language=sv Volume=30 GroupDevices=

Actions for Condition: notifyMe
Device Action Arguments
Takbelysning tv?ttsuga SetTarget newTargetValue=1

Actions for Condition: finished
Device Action Arguments
Sonos K?k Say Text=Klart Language=sv Volume=30 GroupDevices=


According to log the finished-trigger = true… but it never runs the action that is connected to trigger

EvalConditions:Condition:finished Trigger:testWatt Result:true <0x2b625680>

Try:

finished ended and (started; ended)

Have you updated your PLxx plugins to V2.6?

Yes, I have updated to 2.6.

the last expression did unfortunately not make any change. The action never fires…

50 04/07/13 15:57:23.330 luup_log:170: PLEG:170:FireAction:started <0x2b945680>
50 04/07/13 15:58:01.151 luup_log:170: PLEG:170:FireAction:ended <0x2b945680>

Only started, ended fires…

Strange. Can you post the PLEG report (from the Control tab)?

A added a debugging thread … See it and Send me the log …

@RexBeckect

Control tab (alsmost same as in post #7):

Schedules
Name Type Time Days

Device Properties
Name Device Name Device Variable
power Tv?ttmaskin Watts
testWatt K?ksbordet Watts

Conditions
Name Expression
ended testWatt<4
started testWatt>50
finished ended and (started; ended)

Actions

Actions for Condition: notify
Device Action Arguments
VeraAlerts SendAlert Message=Hello WM done! Recipients=
Sonos K?k Say Text=Tv?ttmaskinen verkar vara f?rdig! Language=sv Volume=30 GroupDevices=

Actions for Condition: notifyMe
Device Action Arguments
Takbelysning tv?ttsuga SetTarget newTargetValue=1

Actions for Condition: finished
Device Action Arguments
Sonos K?k Say Text=Klart Language=sv Volume=30 GroupDevices=

@RichardTSchaefer
I attatched the logfile in my previous post.

One can easily recreate my scenario (by adding Watt to any lampdevice and turn it on/off)

A double oops …

  1. sorry I missed the log file.
  2. You found a bug with cascading conditions …
    Please try installing the attached file.

Thanks for helping pin down this problem…

Installed and tried again… but still no FireAction for finished .
Tested both
“ended and (started; ended)”
and
“started; ended”

grep FireAction LuaUPnP.log

50 04/08/13 6:35:46.251 luup_log:170: PLEG:170:FireAction:started <0x2b945680>
50 04/08/13 7:09:23.648 luup_log:170: PLEG:170:FireAction:ended <0x2b789680>
50 04/08/13 7:09:26.789 luup_log:170: PLEG:170:FireAction:started <0x2b789680>
50 04/08/13 7:09:33.457 luup_log:170: PLEG:170:FireAction:ended <0x2b789680>
50 04/08/13 7:09:42.010 luup_log:170: PLEG:170:FireAction:started <0x2b789680>
50 04/08/13 7:10:57.417 luup_log:170: PLEG:170:FireAction:ended <0x2b789680>
50 04/08/13 7:11:14.369 luup_log:170: PLEG:170:FireAction:started <0x2b789680>
50 04/08/13 7:14:03.397 luup_log:170: PLEG:170:FireAction:ended <0x2b6d7680>
50 04/08/13 7:14:18.459 luup_log:170: PLEG:170:FireAction:started <0x2b6d7680>
50 04/08/13 7:14:30.567 luup_log:170: PLEG:170:FireAction:ended <0x2b6d7680>
50 04/08/13 7:14:46.719 luup_log:170: PLEG:170:FireAction:started <0x2b6d7680>

Please Try

(testWatt == testWatt) and (started; ended)

And send me the whole log.

Sent you the log by email. The last expression worked! What is the difference?

It means my change to L_ProgramLogicCEE did not fix the problem …

The cascading expressions is not working properly.
I will send you another fix … but it’s to late to work on it now :-\

Ok, no worries! Take your time.

It actually feels a bit good that it’s a bug. I was about going crazy… I mean my scenario was pretty simple and I just couldn’t get it working…

Thanks guys for pushing me in the right direction. My issue is that the washer from time to time takes a break during the cycle, bringing the consumption to 4W, the same consumption it has when the cycle is done. Checking for WMDone<5 doesnt only provided false alarms.

I have tried using the NOW variable to make sure the condition above is true for at least 5 minutes, which should indicate that the cycle is actually completed. But for the life of me I cannot get it right :slight_smile:

I have:
Input: WMWatts
Condition: WMStarted- WMWatts>500
Condition: WMEnded- (WMWatts<5;Now>5:00)
Condition: WMNotify- WMEnded; (WMStarted;WMEnded)

I have also tried putting the Now clause in a separate condition and using that in the WMEnded condition.

Using vera light and UI5

Appreciate any feedback here.