Laundry done notification

I would like to receive a notification when my washing machine is done. During the cycle the current consumption drops to zero several times which makes it difficult to know when to trigger the notification.
A push in the right direction would be much appreciated.

Put a timer in your logic that is long enough to bridge your periods of zero current.

It will then notify you after the timer expires, after the washer is done. Let us know if you are using PLEG or Luup

Unless you need to know EXACTLY when it is done. In that case you could wire a sensor (mimo lite) to the buzzer.

I gave it a try last night. The code runs fine in Lua for Mac (with manual input of variable “status”) but does not run in Luup. I have scheduled the script to run every minute and I receive a Prowl notification when status>20 but I have no idea whats going on with my while loop. Is it possible to include a print function to be able to see how the value of s changes?

I’m using a Fibaro Wall Plug to measure consumption by the way.

status = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "Watts", 7)
s=3

if tonumber(status)>20 then
luup.call_action("urn:upnp-org:serviceId:IOSPush1", "SendProwlNotification",{ Event= "Start", Description=status, Priority=2, URL=""}, 27)

while s>2 do
s=0.97*s+(1-0.97)*status
end

luup.call_action("urn:upnp-org:serviceId:IOSPush1", "SendProwlNotification",{ Event= s, Description=status, Priority=2, URL=""}, 27) end

If your while loop is intended to be a timer, you could get problems running this on Vera. I recommend you use luup.call_delay(…) instead. There is some example code here.

@mek, what are you using to measure current? If I recall correctly, major appliances such as washers/dryers are supposed to be installed on 20 Amp circuits, but I’m not aware of any z-wave smart plugs rated for that much draw.

here is one

Linear Fs20Z-1 Z-Wave 20A Fixture Mount Control

[quote=“Bulldoglowell, post:6, topic:179092”]here is one

Linear Fs20Z-1 Z-Wave 20A Fixture Mount Control[/quote]

Thanks Bulldoglowell. That appears to be an isolated contact relay. Does that device have a current-measuring feature that I’m missing?

If your while loop is intended to be a timer, you could get problems running this on Vera. I recommend you use luup.call_delay(...) instead. There is some example code here.

My idea was to use os.execute(“sleep 10”) to take one sample every ten seconds, ie. run the while loop every ten seconds. I’m not really sure what that function does but it works as intended in Lua for Mac.

@mek, what are you using to measure current?

As mentioned earlier I’m using the Fibaro Wall plug, since we are using 230V here in Sweden 10 Amps is enough.

Does anybody have any ideas why my while loop is not working?

Does anybody have any ideas why my while loop is not working?

What is it supposed to do?

The statement: s=0.97*s+(1-0.97)*status appears to be an exponential average function. This would have the effect of dramatically damping the effect of status on s. I don’t see why it would be in a while loop, though. It looks to me that it would never end.

Where did you get the function from?

What is it supposed to do?

I want the while loop to run as long as s>2 and then continue to luup.call_action("urn:u… below to send the notification.

The purpose of s=0.97*s+(1-0.97)*status is to smooth the input signal “status”.

I appreciate your help, Lua is all new to me and I may be asking some really newbie questions :-\

One problem here and it was mentioned earlier is that you can not have loop that runs longer than 60 seconds. Vera will restart the luup engine as it thinks something is wrong due to the long running thread. Scenes are designed to perform an action and exit. They are not intended for long running tasks. You might want to look into PLEG.

  • Garrett
you can not have loop that runs longer than 60 seconds

Thanks, thats good to know. I may have look into PLEG to find a solution.

Sorry to necro this thread, but my question is directly related to the OP’s.

So I just got around to installing an energy meter onto my washing machine for the purposes of getting laundry-done style notifications. having run a load and watched the energy meter, saying “the current consumption drops off several times” is a bit of an understatement. saying “the current consumption drops off several times a minute” would be more accurate.

Using luup to track if the laundry is done, the direct approach would be to call luup.call_delay every time the amount of power consumption drops off. This would work, but I’m concerned about the amount of resources that might consume. Is there an upper bound to how many timers lua can handle at any given time? I would imagine that using a delay of 5 minutes for example could cause several dozen pending calls to “checkWasher” to queue up. Are there any harmful side effects I need to be aware of?

Can’t you install a sensor next to the lock of the door, when the door is unlocked to notify you…

maybe a proximity sensor or microswitch paralel to the lock?

Cor

[quote=“Cor, post:14, topic:179092”]Can’t you install a sensor next to the lock of the door, when the door is unlocked to notify you…

maybe a proximity sensor or microswitch paralel to the lock?

Cor[/quote]

Interesting thought! tracking the state of the physical lock would indeed correspond nicely to “washing machine is busy”. But that said, I’ve already procured an energy meter and accidentally discovered a hidden advantage to that approach (besides the obvious one of not needing to void any warranties)… when my washing machine is “on” but idle, it consumes a constant 3-5W, but when it’s off it consumes 0W. Since the machine shuts off the moment the door is opened this means the vera can track distinct states for off, idle, running, and come-get-yer-stuff.

as for the question of timers, what I think I might do is a two-stage sleep. every time the energy meter drops under 10W, I’ll luup.call_delay with a ten second timer. at the end of ten seconds, if the energy state has been continually “idle” for the entire time, I’ll call a longer sleep (yet to be determined how long this needs to be) to check if the washer has actually finished churning and bubbling. this should cause the vast majority of spurious drops to 5W to time out relatively quickly.

Yes, having so many timers running at once could cause resources to run out.

However, you could have a timer that expires after a minute, and restarts itself if the condition is not met.

Then record the last time your power dropped. In your timer function, see if the time since the last power drop has been five minutes. If so, send the alert. If not, restart that one minute timer.

Hi
I have looked for good solutions to monitor the washing machine but I haven’t found anything that works for me or doesn’t rely on PLEG. I have nothing against PLEG, I just prefer to do things myself. I had a working solution before that for some reason stopped working after a firmware upgrade. That solution relied too much on scenes and devices talking to each other and since (at least my) Vera has its mood swings I thought I should try to code something that required a minimum of settings in Vera.

I thought I should contribute with a little bit of code if anyone is interested. You need a CountdownTimer (from the Vera app store) and of course a power meter clamp. Please feel free to use at your own risk. If you do any nice improvements of the code please post it here.

Instructions:

  1. Create a CountdownTimer and call it “Washingmachine timer”, set the duration to 30 sec.
  2. Paste the script into your startup script. Modify the parameters in the CheckPowerMeterEvent() call according to the comments in the code.
  3. Also insert your own code where the comments are for what you want to happen when the machine starts/stops.
  4. Create a scene called “washing machine starts” and make it trigger when watts goes above 10 (value may depend on your machines idle consumption). In the scene’s lua window (“Also, execute the following Luup code”) insert “CheckWashingmachine()” without the quotes of course. When the PowerMeter goes above 10w the script will start and it will in turn start the countdown timer.
  5. Create a scene called “washing machine timer” and make it trigger on the “Timer completes (ignoring mute status)” event. Also add “CheckWashingmachine()” in the scene’s lua window (like above).

[code]function CheckPowerMeterEvent(threshold, delay_event_under, delay_event_over, deviceNo, timerNo)
local ENERGY_SID = “urn:micasaverde-com:serviceId:EnergyMetering1”
local TIMER_SID = “urn:futzle-com:serviceId:CountdownTimer1”
local last_watt = luup.variable_get(ENERGY_SID, “LastWatts”, deviceNo) or “0”
local last_change = luup.variable_get(ENERGY_SID, “LastTimeThresholdChanged”, deviceNo) or “0”
local current_watt = luup.variable_get(ENERGY_SID, “Watts”, deviceNo) or “0”
local timer_muted = luup.variable_get(TIMER_SID, “Muted”, timerNo) or “0”
last_watt = tonumber(last_watt)
current_watt = tonumber(current_watt)
last_change = tonumber(last_change)
local trigger_event = “none”

luup.variable_set(ENERGY_SID, “LastWatts”, current_watt, deviceNo)
luup.call_action(TIMER_SID, “StartTimer”, {}, timerNo)

–If current watt is BELOW the threshold…
if current_watt < threshold then
if last_watt >= threshold then
–If the previous watt was high and it is low now, a new timestamp is set
luup.variable_set(ENERGY_SID, “LastTimeThresholdChanged”, clock(), deviceNo)
else
–If the previous watt was low…
if (clock()-last_change)>=delay_event_under then
–…and it is time for an event then stop the timer.
trigger_event = “under”
luup.variable_set(TIMER_SID, “Muted”, “0”, timerNo)
luup.call_action(TIMER_SID, “CancelTimer”, {}, timerNo)
end
end
else
–If current watt is ABOVE the threshold…
if last_watt < threshold then
–If the previous watt was low and it is high now, a new timestamp is set
luup.variable_set(ENERGY_SID, “LastTimeThresholdChanged”, clock(), deviceNo)
else
–If the previous watt was high…
if (clock()-last_change)>=delay_event_over then
–…it may be time to launch “over”, if the timer isn’t on “mute”.
if timer_muted==“0” then trigger_event = “over” end
– Set the timer to “mute” to not throw another “over” event when the timer launches next time.
luup.variable_set(TIMER_SID, “Muted”, “1”, timerNo)
end
end
end
return trigger_event
end

function CheckWashingmachine()
– ************************************************************
– The row below is VERY IMPORTANT for your configuration
– Explanation of the parameters in the example:
– 1) The “10” means that if more than 10 watts are consumed the “over” event should be launched. If it is below, the “under” event should be launched.
– 2) The “under” event requires a steady (low) consumption for at least 120 sec.
– 3) The “over” event requires a steady high consumption for at least 180 sec.
– 4) The PowerMeter has id=124.
– 5) The “Washingmachine timer” has id=73.
– Note: with “steady” I mean what the consumption is when the timer launches the script.
– In this example the timer triggers every 30 sec and you then need 4 readings below 10 watt in succession to be sure the machine is done (=trigger “under” event).
– ************************************************************
local launchevent=CheckPowerMeterEvent(10,120,180,124,73)

if launchevent==“under” then
–Things to do when the washing is DONE (I play a little tune in Sonos)
elseif launchevent==“over” then
–Things to do when the washing is STARTING
else
–Things to do meanwhile the washing machine is working. (probably nothing)
end
end[/code]

I hope it helps someone.
Have fun!
/Claes

If you do things your self … why are you using Countdown timer ?

I used Countdown timer and Combination switch for logic when I first started with Vera.
The fragmented logic using multiple scenes with these to accomplish a task is what motivated me to do PLEG.

I know this is a very old chain but for those currently trying to do this the easiest way is to install the application now available called Reactor in the App Store. I had the same issue where the power would go down to zero multiple times during a wash cycle making timers challenging. Using reactor it was simple to setup a trigger to go off only when the voltage went to zero for 90 seconds. I was looking into pleg and timers etc but in the end the reactor app made this easy. Good luck.

@maksympc [quote=“jbonzey, post:19, topic:179092”]
Using reactor it was simple to setup a trigger to go off only when the voltage went to zero for 90 seconds. I was looking into pleg and timers etc but in the end the reactor app made this easy.
[/quote].

Will a similar option become available in the Ezlogic UI?

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules