Close

The state of machine state machines

A project log for Laundry monitoring

A collection of notes and pointers for the usual laundry monitoring project.

wjcarpenterWJCarpenter 07/02/2023 at 01:240 Comments

Both the washer and the dryer have these possible states:

  1. UNLOADED (ub). The machine is not running and has no laundry in it.
  2. LOADING (la). Laundry is being loaded into the machine.
  3. LOADED (lb). There is laundry in the machine, but it is not yet running.
  4. RUNNING (r). The machine is running.
  5. STOPPED (s). The machine is stopped at the end of its cycle.
  6. UNLOADING (ua). Laundry is being unloaded from the machine.

We'll only have two sensors for each machine: the power monitor, as a simple binary sensor (on or off) and the door sensor (open or closed). 

With 6 states for each machine, there are 36 possible state combinations. With two sensors per machine there are 8 possible sensor inputs and 1 or more "some time has passed" inputs. We make the simplifying assumption that sensor inputs never occur at exactly the same time, so they can be treated independently. The states for separate machines can obviously overlap.

For a while, I thought about making a big state transition matrix, with 36 states and 8 or 9 types of event transitions. That would be a very sparse matrix, with most of the transitions being either impossible or no-ops. Instead, let's look at the states for an individual machine. 

The above stages are the normal progression of things for each machine. Only a couple of combinations are interesting for human attention:

  1. Dryer is STOPPED, washer is in any state.
  2. Washer is STOPPED, dryer is UNLOADED (or STOPPED, from the previous rule). We also include UNLOADING in case someone left the door open after unloading.

Assuming we have some kind of notification out for attention, we can automatically cancel the notification for any of these events happening:

For the doors and power monitor, we can considering having separate notifications and cancellations . We can also consider having some kind of reminder loop if someone acknowledges the notification but we don't see the expected attention to the laundry.

There are a lot of things that could go wrong with this cold algorithmic plan. For example, someone could open a machine door and not actually unload the machine. Best effort here is probably good enough for now.

Discussions