I have an old waschmachine without integration in wlan.
So I have installed between current and waschmachine an switch that can read the power of the machine.
So I need a rule, that send me a message, if the power over 10 minutes under 3 watt.
How can I do this?
I have a very similar setup to you. The way I have my rule set up is that once the power goes below a certain wattage threshold I set a timer for 2 minutes, if the power is still low after those two minutes the washing (and drying with the same setup for a dryer) is finished. If however the power goes up again during those two minutes (time may vary from case to case, depending on how the power might drop in between cycles for a short while) the timer gets canceled again, as the machine is still washing.
var Timer Washer_Off_State_Timer = null
rule "Washer ON OFF Detection Rule"
when
Item Washer_power changed
then
if (Washer_State.state != 1 && Washer_power.state > 50.0) {
logInfo("Washer", "Washer: Turned ON")
Washer_State.postUpdate(1)
} else if (Washer_power.state > 3.0 && Washer_Off_State_Timer !== null) {
Washer_Off_State_Timer.cancel()
Washer_Off_State_Timer = null
logInfo("Washer", "Washer: OFF Timer reset")
} else if (Washer_power.state <= 3.0 && Washer_State.state == 1) {
if (Washer_Off_State_Timer === null) {
logInfo("Washer", "Washer: OFF Timer triggered")
Washer_Off_State_Timer = createTimer(now.plusMinutes(10)) [|
Washer_State.postUpdate(0)
logInfo("Washer", "Washer: Turned OFF")
// Do your thing here to get notified that the washing has finished
if (Washer_Off_State_Timer !== null) {
Washer_Off_State_Timer.cancel()
Washer_Off_State_Timer = null
}
]
}
}
end
Just quickly cobbled together from my larger rule, so need to quickly go over it again to see if I made any hickups
Can’t remeber now why I made Washer_State a Number and not a Switch, but still does its job. You can also make a chart with Washer_State, which then only gives you the 0/1 - OFF/ON chart for your washing machine in addition or instead to your power chart.
Item Number Washer_State
P.S. Looking at my more complex and ancient rule again I now know why I chose a Number. I wanted to have a 3rd possible state as my Washing machine is far away from the receiving bridge. So if Washer_power doesn’t change for a longer period when the washing machine is ON, i.e. Washer_State == 1, it means that there is no Washer_power changes (which usually happen frequently) and the radio connection has a problem. This would set Washer_State to 2 - Connetion Error. Luckily in all the years this has never happened and the connection is good even with the long distance.