Hi folks,
I really had the need to do something fun, to compensate the hustle and bustle from the daily life madness.
My use case is this one: before the wife goes to work she puts the laundry in the washing machine. As soon as it is ready, I have to put it into the dryer. But most of the time I forget about that.
So I want to get a notification on my smartphone as soon as the washing machine is ready. A way to measure this, is by using a Shelly Plug S in the wall outlet to measure the energy consumption. I got some useful tips in another discussion about how to determine next when the machine is ready.
But then I started wondering if we could go one step further. When you look at a washing cycle, you will see that it consists out of of different phases/states. I was curious whether it would be possible to determine the different states. I don't have a true use case for it, but after all a hobby does not to be useful... If somebody has some use cases that I can put on my readme page, please let me know!
I did have a quick look at some npm libraries, because I thought that the AI hype would offer a solution for this. But couldn't find anything in my limited time, so I implemented a solution based on a sliding window that does simple pattern matching on the samples passing by. Which means one pattern per state.
EDIT: With node-red-pattern-state-mapping you can specify a basic patteen to detect the start of a state, and in which sequences states can occur. The start of a state is detected by a sequence of N numbers from which M numbers must be between X and Y.
Here is the demo, which draws the samples as a line chart per state in dashboard D2:
Some background info about these states:
- Off
- Fill (the machine with water)
- Heating (of the water consumes a lot of electricity)
- Rinse and spin (to take extra water and rotate the laundry)
- Final spin (to rotate the laundry to make it less wet).
- Off again
As always, all constructive feedback is very welcome.
Bart