Before you start reading, start this song:
It should make reading the blathering nonsense below slightly less annoying.
Aren’t I helpful.
Anyway. We were chatting on irc the other day about this:
And I was going “and that’s why I’ll never have an Internet-connected washing machine. Never! That’s totally insane and only total morons would do that! Hackers will install ransomware on the washing machine and demand hundreds of bitcoins to set my laundry free!” But then somebody said “it sure would be convenient if the washing machine could tell me when the cycle was over” and I went “yes! I want that! I have to buy an Internet-connected washing machine straight away!”
Let me explain: I usually batch my laundry. Once in a while I’ll go “I sure do have a lot of things I should wash”, and then I spend the rest of the day running everything through the washing machine. But the problem is that I can’t hear the alarm that says “done now”, and I’m forgetful, so these laundry days aren’t as efficient as they could be: The washing cycle may have been over for an hour or two before I remember to check, and that means that I don’t get done with everything as planned.
This is the worst problem ever in the history of mankind! HOW CAN ONE LIVE LIKE THIS
But… I’m really satisfied with my Miele W 3923 — I’ve had it for… what… 15 years now? And there’s never been any problems, and it washes things very gently, and most important of all: It glows in the dark.
So I wondered: Could I detect the “beep beep”s at the end and use that to make some kind of notification device… but then I thought “electricity!” Surely someone has made a device to measure power usage that has a convenient local API I can access?
The TP Link Tapo P110 looks exactly what I need, and somebody has made a Python library to interface with it locally. So I can script something that detects that the machine is running, and when it stops running, it notifies… something… that I’ll actually notice? Worth a shot.
(No, I don’t want to integrate this with Alexa or anything. And I think I’ll block it from accessing the Internet, because these devices update automatically, and you can’t switch the updates off, even if the app says you can and they will randomly stop working because they change the API. And besides, I don’t want a botnet to use it to DDoS Sourcehut or whatever.)
So with the plug installed and configured, I can measure what the washing machine pulls when idle. Let’s see… when it’s idle and the light is on, it pulls 5W. When the light goes off, it’s 2W, so I guess that’s the basic idle wattage.
Let’s see what a washing cycle looks like.
The bad news is that a wool cycle is very… languorous.
It starts off by pulling in some water, and then it jumps up to 2kW while it’s heating the water to 30C.
But after that, it’ll mostly just soak the clothes, so it’s at 3W for a couple of a minutes at a time between doing anything. And at the end there, when it’s done (after that final spin cycle), it’s also at 3W!
So if I just do this naively, I’ll have to wait for several minutes to be sure that the wool cycle is over. And that sucks! It’s a very… “trailing indicator”, and I want to be Maximally Efficient, right?
And this is what a 60C cotton cycle looks like: It’s a lot more energetic, and it basically seldom goes down to idle wattage (i.e., 3W). However — it doesn’t really flatline at the end there, either? Let’s zoom:
Yeah, it does an anti wrinkle thing — it rotates the drum a couple times per minute after ending the cycle. So I can’t really do a “just check for idle power” here, either.
Well, perhaps we can recognise patterns in the data? Perhaps I should send the data to ChatGPT and ask “is the washing cycle over now? How about now?” Or perhaps not.
The wool cycle ends with 20s of 13-14W, and then we go down to 3W. That’s something that never happens elsewhere in the cycle, and should be easy to detect!
For the cotton cycle: It seems like the anti-wrinkle thing at the end is basically around 30-35 seconds of 3W, and then between 4s and 10s of >30W. And then repeat. And eyeballing the data… it doesn’t seem like that pattern ever appears during the wash cycle.
But does the end-of-wool signal appear during the cotton cycle, or vice versa? Hm… Well, I’ve got the data, so I can just implement my guesses here, and then simulate the thing.
When the thing is running, the algorithm should basically be: The script polls the P110 once every minute. If it detects that the washing machine is running (i.e., uses more than 20W, say), it shifts to polling every second, so that it can get the shape of the curves here. Then when it detects end-of-cycle, it notifies me by flashing some lamps in the apt. And then, if it detects either that I’ve started a new cycle, or that I’ve switched the washing machine off (i.e., it goes down to ~0W), it stops flashing the lights? I think that should basically be sane. (And perhaps I should have a button somewhere to switch the flashing off manually, in case of er me being to lazy to take the things out of the washing machine right away.)
Yay! It works for the wool cycle!
But there’s a false positive in the cotton cycle at 21:05, and then it thinks that the anti-wrinkle means that it started again. OK, bugs…
OK, I should have implemented that by a state machine and not half-assed it, because it’s pretty brittle… It might not work on, say, the silk cycle? But state machines are hard, man. I mean, to test.
For the alarms… well… a flashing duck? That should be alarming enough.
I don’t really have any singly-connected “subtle” lamps like that (and I guess they should be LED because they survive flashing better, perhaps?) in the living room, but how about this one:
OK, this is going to save me at least… MINUTES… over the next decades.
Or until next year, when the washing machine breaks down and I get a WIFI-connected one.