[ANNOUNCE] node-red-pattern-state-mapping (beta)

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:

  1. Off
  2. Fill (the machine with water)
  3. Heating (of the water consumes a lot of electricity)
  4. Rinse and spin (to take extra water and rotate the laundry)
  5. Final spin (to rotate the laundry to make it less wet).
  6. Off again

As always, all constructive feedback is very welcome.



Nice Bart! And should work with anything that has a periodic energy use as long as you take the time to work out what each pattern means.

The dryer for example. Underfloor electric heating? Dehumidifier (spot when it is full and needs emptying?), ...

Actually, if you regularly do some processing on your PC, you could probably work that out too.

Hey Julian,
My patterns are very basic: from N succesive values, at least M values should be between X and Y. So no way to recognize fancy sequences as a state. This node offers only low budget AI, based on human interpretion of data :yum:

1 Like

Very nice Bart !! This has finally pushed me into taking the plunge and migrating across to Dashboard 2

Great work (and thanks for all you do on the forum)


1 Like

Seems I forgot to add a link to my repo. I have added the original post above now.

Nice work. I did it with a finite-state-machine node (node-red-contrib-persistent-fsm) for my pellet stove. I would try yours as it's much simpler to configure.

1 Like

Nice, been thinking of doing something like this for a while, not got anywhere, mainly because I couldn't see the wood for the complicated trees within it!

...and as for

What are you saying about yourself?? I, for one, feel you are worth more than that!! :grinning: :rofl:

Well in fact I was talking about the users of this node :yum: