We have moved at community.getvera.com

Author Topic: Trigger scene over average power metering  (Read 5915 times)

Offline bubaleta

  • Full Member
  • ***
  • Posts: 111
  • Karma: +1/-0
Re: Trigger scene over average power metering
« Reply #15 on: November 30, 2013, 06:01:26 pm »
Ok, now it seems to work

Quote
Conditions
Name   Expression   Last True   State
TimeConstant   sample ? 0.5 : 1   2013-11-30 18:13:22.102    0.5
Filtered   (Filtered * TimeConstant) + ((1 - TimeConstant) * power)   0   38.5
AutoOff   Filtered < 80   2013-11-30 22:50:38.107    true

but the action is triggered even if there is 0W.

How would I add a condition to not fire if under 50W for example?
Could it be:   Filtered < 80 & sample >50
or do I need to add another condition.

The rest works pretty well... just to get this straight, we get a sample every 30 seconds and average with stored data until below 80, right?

How heavy is this kind of sampling/calculation on the vera processor?
Is it worth to bypass the PLEG when not needed?

Thanks!
« Last Edit: November 30, 2013, 06:09:26 pm by bubaleta »

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: Trigger scene over average power metering
« Reply #16 on: December 01, 2013, 06:33:35 pm »
Quote
Could it be:   Filtered < 80 & sample >50

Close! it should be:
           Filtered < 80 AND power >50

Quote
How heavy is this kind of sampling/calculation on the vera processor?
Is it worth to bypass the PLEG when not needed?
This eats up a few ms of CPU every 30 seconds ... or when the power changes.
Probably equivalent to the overhead the Plugin that is reading the power in the first place.

Offline bubaleta

  • Full Member
  • ***
  • Posts: 111
  • Karma: +1/-0
Re: Trigger scene over average power metering
« Reply #17 on: December 02, 2013, 02:45:24 am »
That's perfect, thank you.

Just by turning on the system, triggers almost instantly...
I created a scene to delay arming PLEG for a minute or so, and disarming when turning off.
Is there a way to do this inside PLEG without new scenes?

Also I'd like to know if it'd be possible to reset AutoOff to false before/when arming PLEG.

Thanks again for sharing your knowledge

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: Trigger scene over average power metering
« Reply #18 on: December 02, 2013, 07:30:15 am »
Do the following ... and it will only trigger on the falling side:

BelowSetPoint        Filtered < 80
AboveSetPoint        Not BelowSetPoint
AboveLowSetPoint    power > 50
AutoOff                  BelowSetPoint AND AboveLowSetPoint AND (AboveLowSetPoint; AboveSetPoint; BelowSetPoint)

This breaks the condition down into parts .. The reason is to get a time stamp for the different events. The last part (AboveLowSetPoint; AboveSetPoint; BelowSetPoint) is a sequence expression and is true when the time stamps are in the specified order. In English this means that the AutoOff will trigger when the filtered power is below 80 AND the instantaneous power is above 50, but only if the AveragePower was above 80 in the first place.

Offline bubaleta

  • Full Member
  • ***
  • Posts: 111
  • Karma: +1/-0
Re: Trigger scene over average power metering
« Reply #19 on: December 02, 2013, 11:47:15 am »
That works ok.
Thank you.

Is it possible to execute some lua code as an action?
Can't seem to find the place to put the code in the actions tab

Offline bubaleta

  • Full Member
  • ***
  • Posts: 111
  • Karma: +1/-0
Re: Trigger scene over average power metering
« Reply #20 on: December 02, 2013, 11:55:31 am »
Ok, I found the documentation for Program Logic Core and I see it is not possible to add luup code.

I guess I'll have to call a new scene with that code inside.

Offline RichardTSchaefer

  • Community Beta
  • Master Member
  • ******
  • Posts: 10091
  • Karma: +764/-143
Re: Trigger scene over average power metering
« Reply #21 on: December 02, 2013, 07:03:17 pm »
No,but you can run a scene that has lua code in it.