Subscribe to power measure events with duplicates?


I am creating an app that detects whether a device is no longer consuming more than X watts over a period of time, to determine when my laundry is done. I use a Fibaro wall plug for this, and have configured it to send an update every 2 minutes whether the power consumption has changed or not. However, it seems this subscription does not trigger “meterHandler” when the value has not changed (tried with and without filterEvents):

subscribe(meter, “power”, meterHandler, [filterEvents: false])

Basically, i want to check whether my device has not consumed any power the last two or three minutes.

Any help would be appreciated :slight_smile:


Since power should update any time the power level changes, you don’t need it to send redundant power events every two minutes.

Intead, you need a timer to go with the “power” event handler - when you see the power drop to (near) zero, schedule a runin() event for 120 seconds from now that checks to see if the power is still (near) zero. If necessary for your app, you can use a state.variable to track when you are waiting to see if power stays (near) zero - reset it if a >0 reading is observed during the wait…

I use the ST Energy Alerts app. It notifies me whenever the outlet the washer is plugged into reports > 1W , <5W with a push and SMS notification. It has worked flawlessly for over a year notifying when the washer is done with my LG front loader.
HOWEVER I tried doing the same thing with the daughter’s Maytag and found that it actually drops to 0W every cycle change, so I was getting 5-6 notifications with every load of laundry.

Thanks for the tip about runin(). I also have a washer that goes to 0 several times during the cycle, but i ended up using CORE and a if “X stays below 3W for 2 minutes” trigger on a piston :slight_smile: