Best way to detect a pattern in a power sensor?

Hi all, what is the best way to actually capture that a certain pattern in power consumption happened (the sensor is device_class: power, state_class: measurement, and measurement_unit: W) so that I can detect the end of e.g. a washing cycle. The cycles are always a bit different depending on the program and the load so I was thinking about an ML model that one could train with a number of these patterns and then tell it what the end of the cycle is in the training. Any best practices or experiences out there how to do that in HA?

Here are a few washing cycles from the past week:

and here are two from today zoomed in a bit more.


Hard to tell since I don’t know what the machine was doing during those graphs (was it on the whole time, or just at the big peak?), but in my case I wait until the power drops to zero for a specified time period before indicating that a load is done, as the usage frequently drops to zero during a cycle for a short time. I think I found that if it dropped to zero for a minute, that always meant it was done. My assumptions from those graphs, something like this would also work in your case.

I am running this blueprint and that works fine for my washing machine and dryer: πŸ”Œ Detect and monitor the state of an appliance based on its power consumption - V2.1.1 - Updated!

I had tried such a straight forward approach as well, but got too much false signals since in my case the machine is close to 0 during the cycles a few times and then not at 0 when it is done. And then also wakes up once in a while to turn the drum to avoid wrinkles which also makes the signals less predictable. And of course it always depends on the program. hence, instead of trying to manually find the right threshholds, my hope was to train a ML model for a few weeks and then it would be able to detect the end of a cycle in all the trained cases. In any case, I am trying the blueprint @fversteegen pointed to and will see if that works for me as well. Thanks!

Thanks I will give that a try as well!

Any progress please?

1 Like