The Reason:
I live in the country and have a water pump, I wanted to be able to monitor cycle times for the pump, along with being able to easily turn the pump off when I leave the house, and turn it back on when I return.
The Items:
WaterPumpWatts=Watts reported by the Smart Switch
WaterPumpSwitch=Smart Switch Power ON/OFF
Security Switch= VRS15 Scene Capable Push On/Off 120 Volt switch, because it allows node groups. Turns security system on/off.
WaterPump_ResetMeter=switch witch resets KWh accumulator on Smart Switch
PumpRun, PumpStop=Date time variables
The first rule, sends an a text to my phone, using the mail action whenever the pump starts or stops pumping water.
import org.eclipse.smarthome.core.library.types.DateTimeType
var String PumpRun = "off"
var String PumpRun1 = "off"
//Send a message when the Well Pump stops running
rule "PumpState"
when
Item WaterPumpWatts changed
then
if (PumpRun == "on" && WaterPumpWatts.state < 100)
{
PumpRun = "off"
postUpdate(Pump_Stop, new DateTimeType())
Thread::sleep(10000)
sendMail("Yourph#here@vtext.com", Pump_Stop.state.format("%tR") +" "+ Pump_Stop.state.format("%tD"), " Pump Stopped")
}
//Send a message when the Well Pump starts running
else
if (PumpRun == "off" && WaterPumpWatts.state > 800)
{
PumpRun = "on"
postUpdate(Pump_Run, new DateTimeType())
Thread::sleep(10000)
sendMail("Yourph#here@vtext.com", Pump_Run.state.format("%tR") +" "+ Pump_Run.state.format("%tD"), " Pump Running")
}
end