Calculate and notify Pool Pump Runtime

Hi All,

Using the cunningly simple and brilliant idea that Bulldog posted about running his pool pump on a schedule relative to sunrise and sunset (+3hr/-3hr).

What I’d like to do is when the pump is turned off (or once per day) to send an email or push alert that tells me how long the pool ran for (hh:mm).

Anyone got something I can R&D (rob and duplicate)? :smiley:

You can do this with PLEG and your favorite notification plugin (I authored and use Vera Alerts)

Input Schedule
PoolSchedule ON every data at Sunset + 3:00:00, OFF at Sunset - 3:00:00

PumpOn PoolSchedule
PumpOff !PoolSchedule

PumpOn - Turn On Pump
PumpOff - Turn Off Pump
Send Vera Alert with message of:
Pump ran for {(#PumpOff - #PumpOn) /3600) hours.}

There is a bug in PLEG 8.14 that will incorrectly define schedules relative to sunset.
To fix this:

  1. Refresh Browser
  2. Goto Advanced Tab of PLEG device
  3. Edit the “Schedules” variable … change the -3:00:00s to -3:00:00t
  4. Reload your Vera

That’s perfect, thanks Richard. And thank you for pointing out that bug, I would have been left scratching my head as to why the schedule wasn’t working.

Is there a way to find out what the forecast sunset/sunrise times are for today?

Most weather websites include that info.

[quote=“RichardTSchaefer, post:2, topic:193117”]PumpOff - Turn Off Pump
Send Vera Alert with message of:
Pump ran for {(#PumpOff - #PumpOn) /3600) hours.}[/quote]

Hi Richard - can you confirm for me that message string for Vera Alerts? I’m not getting a number from the calculation, it’s sending me the message exactly as it’s written with the variable names (I’ve replaced them with my condition names).

Minor error:

Pump ran for {(#PumpOff - #PumpOn) /3600)} hours.

Still doesn’t appear to be working… key bits below, I can’t see what I’m missing (sure it’ll be obvious). I’m assuming I can just run the action and it’ll pick up the true/false times for the conditions?

Action: cPool_Pump_Off

VeraAlerts[142] SendAlert Message=Pump ran for {(#cPool_Pump_Off - #cPool_Pump_On) /3600)} hours. Recipients=aiw15lgd6171 HouseModeMask=

cPool_Pump_On sPool_Pump false 2016-07-25 10:10:34.148 2016-07-25 14:36:21.124
cPool_Pump_Off !sPool_Pump true 2016-07-25 14:36:21.125 2016-07-25 10:10:34.155

Missing a Parenthesis

Expressions in actions are {( SomePLEGExpression )}

The PLEG Expression you want is:
(#!SomeEvent - #SomeEvent) / 60

Will give you the delta in Minutes

See my attached Test PLEG.

And if you want to format the number a little … Vera Alerts has template ability and you can use:

a Message of the form:

On Time {String.format(%6.2f, {((#!sTest - #sTest)/60)} )} Minutes

That will display the number with only two digits past the decimal point.

Thanks Richard - was getting a negative number so swapped the ! around for the condition subtraction.

Final result for future readers:

Message=Pump Run Time - {String.format(%4.1f, {((#cPool_Pump_Off - #!cPool_Pump_Off)/3600)} )} Hours

Today the message was 4.5 hours. (or 4.45 if you go with 2 decimal places in the message).