This Time Self-Hosted
dark mode light mode Search

Smart Plugs Tricks: Air Fresheners and Washing Machines with Home Assistant

You may remember I bought my first smart plug some years ago to control the Christmas tree that my wife and me bought and set up. At the time, I had been thinking of what other good uses a smart plug could be used for. It wasn’t until I bought the SP111 to run ESPHome that I realized I could use it to control the subwoofer for the home theatre, in a fit of almost utter laziness (not wanting to stand up from the sofa to turn it on or off.)

Since then, I found a few different uses for them, both for those plugs with power metering and not, so I thought I would share them with the rest of the world. My implementation of these solutions is via Home Assistant, but I’m going to describe them so you can implement the same concept with any other solution, though your mileage may vary then.

Before getting into the nitty gritty of the solution, I should point out that for one of the two tricks to work, you need a smartplug that can report the instantaneous power consumption. As noted above, for this I use the SP111 with ESPHome — but that does not appear to be available anymore, as it relies on a project called tuya-convert that does not work with newer firmware versions. On the other hand, Home Assistant has, in the past months, added a well-supported integration for Tuya that should provide the same, but since I have not used it, I have no idea whether it would work with that.

For the other trick, any Home Assistant compatible plug will do. Due to the limited amount of SP111 with power reporting that I had available, I decided to grab a few more smartplugs for where I don’t need information on the used power. This made using Zigbee plugs a lot easier – I added a Zigbee stick to Home Assistant last year when I wanted to mix non-Hue lights in the apartment – since I couldn’t find any Zigbee smart plug that included power monitoring. I went for a set of SONOFF plugs.

To be quite honest, using Zigbee smart plugs turned out to be fantastically easy — while I’m not using ZHA (for silly past reasons that might no longer apply), even zigbee2mqtt took a total of 10 seconds to set up the plug. The fact that Zigbee devices extend the mesh also make adding more Aqaria buttons around the flat more interesting, since when I tried them before I did end up having connection trouble, and so fell back to Flic buttons instead.

First Trick: Laundry Is Waiting

The first trick handles one of my pet peeves, the fact that our model of washing machine cannot tell when the door lock has disengaged before notifying to pick up laundry that went through the drier. This leads to ignoring the “cycle complete” beeps, which in turn has had us forget about the laundry a few times too many for my liking.

So I added a smartplug with a power monitor to the washing machine. This allowed me to record how much power it consumed at various times, and realize that until the end of the cycle, it doesn’t go below 0.1A of current for more than ten minutes. And since ten minutes is just around the time it takes for the door lock to disengage, that made it very simple to have a Home Assistant binary sensor to signify the washing machine is running:

template:
  - binary_sensor:
      - name: "Washing Machine Running"
        unique_id: "washing_machine_running"
        state: >-
          {{ states('sensor.washing_machine_current') | float(default=0.0) > 0.1 }}
        delay_off: 00:10:00
        icon: mdi:washing-machineCode language: YAML (yaml)

This is great but does not solve the problem fully: while it allows for a notification to be sent (to our mobile phones) that the cycle completed, it does not have a way to track whether we already took the laundry out. This may not sound like a lot, but if you get your laundry notification while you’re busy with making dinner, it’s easy to forget about it. So I needed a way to remind us before we start getting ready for a good night sleep.

So for that to work I created a new input boolean helper in Home Assistant, called laundry_waiting. This helper is turned on by automation when the washing machine stops running, and is turned off by the click of a Flic button glued to the front of the washing machine:

alias: Laundry  Turn On Laundry Waiting
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.washing_machine_running
    from: 'on'
    to: 'off'
    id: washing_machine_finished
  - platform: webhook
    webhook_id: flic.washing_machine.double
    id: laundry_unloaded
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: washing_machine_finished
        sequence:
          - service: input_boolean.turn_on
            target:
              entity_id: input_boolean.laundry_waiting
            data: {}
      - conditions:
          - condition: trigger
            id: laundry_unloaded
        sequence:
          - service: input_boolean.turn_off
            target:
              entity_id: input_boolean.laundry_waiting
            data: {}
    default: []
mode: singleCode language: YAML (yaml)

This permanence is useful, and could have been achieved in a different way, which I’m still considering as an option, but found not needed for now: as I noted in the post about energy usage, the old washing machine “idle” mode is actually using a non-negligible amount of current: 0.02A at 220V makes for slightly less than 1W of power consumed by just the electronics keeping the LED on and blinking, for whatever reason. I could have used the indication of the washing machine being in the “idle” state as an assumption that laundry needs to be taken out, but I decided against it, and that was a good flexibility choice: we had to replace the washing machine last year, and the new one uses half that current.

I also considered having the smartplug cut the power to the washing machine right after it finishes the cycle, and use the flic button to turn it back on. This would in theory ensure that we do for sure click the button when we take the laundry out to be able to use the washing machine, but turns out it got annoying fast. So instead I put a button by the washing machine, and click it when unloading — or, if the washing machine restart, it considers it unloaded and re-loaded.

Then, I added persistent notifications that are sent on both our phones and on the Home Assistant UI, as well as turn the light in front of the washing machine at 30% brightness. The notification happens any time it completes if we’re home (because we generally are home when we run the machine), plus, if we haven’t unloaded it yet, every time we come home and at 10pm — both of those are useful heuristics: if we’re watching TV, we tend to ignore the notifications, but we probably want to be reminded before we try to go to bed, and if we did run the machine while we went out (doesn’t happen often unless neither of us is WFH that day and we’re running out of clothes), we won’t care about the notification until we can do something about it.

Second Trick: Air Fresheners

Who doesn’t like a good air freshener, or aromatizer as Bigclive would call them? Well, turns out that both me and my wife both like a bit of nice aroma around the house from time to time, but very importantly not constantly.

Bigclive is usually spending time to hack those fresheners that “puff” the smell in the air, but we’re not fan of those, and we prefer the plug-in Airwick-style fresheners (although specifically our favourites are Yankee Candle’s), but if you run those constantly, beside the energy waste, you use up the bottle of aroma quite quickly. And there’s really zero reason to keep these running while you sleep, or when you’re not at home!

So instead, I put them all on smart plugs — and the first thing I did, was putting timers on them, so that after half an hour being on, they just turn off. This already improves their experience a lot: when we feel the need to turn on the aroma (say for instance because the smell of cooking coming from the next door neighbour bother us), it doesn’t mean we leave the aroma on for hours on end: the smell is likely going to go away in a few minutes as well.

While originally I used to have manual automation for each of these, I actually since migrated to a Blueprint-based solution, so you can get my Bounce Switch On A Timer blueprint, and attach it to a Timer helper that can be customized for duration, and a switch to be turned off after the timer expires. The blueprint takes care of resetting the timer if the switch is turned off.

In addition to fresheners, I use the same blueprint for lights — with significantly shorter timeouts. This allowed me to stop forgetting the entrance or corridor lights on for too long after coming back in, as well as for turning the lights on/off when we have friends looking after the flag when we’re traveling — in that case, I have automation that changes the timer length when I turn on “travel mode”, and another automation that turns on the lights when the door open and we’re in travel mode.

Then, for the fresheners, beside the manual turning on (including via voice control), they are set up to turn on when we come back home, when we wake up, and just before we go to bed (in the bedroom only) — this way the aroma is effectively “welcoming” us.

Comments 1
  1. I had tried to setup notifications for my washing machine as well, but the smartplug I had bought was rated to 2500W and it started overheating while doing the laundry.

    Thus, for anyone trying this at home, please make sure your plug can handle the high current required by washers and dryers. I’m considering getting a 16A-rated plug (which should be equivalent to 3500W), probably one pre-flashed with tasmota or similar firmware. Like these: https://templates.blakadder.com/preflashed-stand.html

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.