Both the washer and the dryer have these possible states:
- UNLOADED (ub). The machine is not running and has no laundry in it.
- LOADING (la). Laundry is being loaded into the machine.
- LOADED (lb). There is laundry in the machine, but it is not yet running.
- RUNNING (r). The machine is running.
- STOPPED (s). The machine is stopped at the end of its cycle.
- 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 machine starts in a default state of UNLOADED.
- When the door in open for more than some period of time, we assume it's LOADING.
- When the door closes, the we assume the machine is LOADED.
- When the power monitor shows non-zero, the machine is RUNNING.
- When the power monitor returns to zero, the machine is STOPPED.
- When the door in open for more than some period of time, we assume it's UNLOADING.
- When the door closes, the machine is UNLOADED.
The above stages are the normal progression of things for each machine. Only a couple of combinations are interesting for human attention:
- Dryer is STOPPED, washer is in any state.
- 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:
- Someone explicitly acknowledges the notification.
- Either door opens or closes.
- Either machine moves to the RUNNING state.
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
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.