If you have a washing machine that is not smart and it is in your attic or laundry room, then it is sometimes difficult to see whether it is ready yet. In this Home Assistant tutorial, I’ll show you how to make your “dumb” washing machine a little smarter in an easy way. And as a bonus, you get a super fancy dashboard to monitor your washing machine as well! Let’s do this!
โญโญโญ NOTE: โญโญโญ
This article accompanies a YouTube video. I wrote it for people who would rather read than watch a video. To keep doing this, I want to ask you to check out the video, leave a comment under the video, give the video a thumbs up, and subscribe to my YouTube channel. This means that the video is offered more often to new visitors so that they also stay informed of the latest Home Assistant tutorials.
Thank you for your support!
Ed
Introduction
Do you recognize, that your washing machine is ready, but you have not heard the beep and your laundry has been wet in the washing machine all night? That is of course not so nice for your laundry and washing machine. How nice would it be if you received a message on your phone when the washing machine is ready and that you can monitor the status of your washing machine via a dashboard during washing?
We can achieve this in a fairly simple way in Home Assistant. All we need is a Smart Plug that can handle at least 2500 Watts and can measure the power and pass it on to Home Assistant. I use the Shelly Plug S for this. But, you can of course also use another Smart Plug with power metering, as long as it can handle a high wattage level.
Step 1: Connect your Power Plug and make sure that it can be read in Home Assistant.
I am not going to explain this step because there are so many different types of plugs and it is impossible to create one tutorial that is the same for all plugs. But, if you use the Shelly Plug S, you can easily install it with the Shelly integration of Home Assistant. After you have installed this, you can check in Home Assistant whether the power value has arrived.
To do this, go to Settings > Devices & Services and click on the Devices tab. Select your power plug there and you should see that the power value is displayed.
Oh, and for the Shelly Plug, make sure that the security Wattage threshold is set to 2400 or 2500 Watt. By default, it is set to 1800 and most washing machines will go higher than this value. In that case, the plug shuts off and that is not what we want!
With the help of these power values, we are going to make our “dumb” washing machine a bit smarter. Based on those values, we can see whether the washing machine is running or not. For that, we have to determine what the minimum value is for the washing machine.
We can do that simply by turning on the washing machine and reading the power value while the washing machine is on standby. That will be a low value. For me, that value is somewhere between 1 and 3 watts. So I assume that the washing machine is ready when the power value of the washing machine drops below 3 Watts for a few minutes. I consciously choose not to assume a value of 0, because the washing machine is always switched on a bit when the wash is finished.
Step 2: Message my phone when the laundry is done.
We are now going to make an automation that sends a message to my phone when the washing machine is ready.
To do this, go to Settings-> Automations and Scenes and click on Create Automation. Now select Start with an empty automation.
We are going to create two triggers in this automation.
Click on Add Trigger
Select Device and choose your power plug at Device. In my case, that is Washing Machine
Now choose the trigger that displays the power value. In my case, that is Washing Machine Power power changes.
We want to be notified when the value drops below 3 Watts for a few minutes. Because in that case, our washing machine is ready.
Enter 3 at below.
And enter 3 minutes at Duration.
Now go to Actions and click on Add Action.
Choose Call Service
And choose the service that sends a message to your phone. In my case, it’s Notifications: Send a notification via mobile_app_iphone
Now enter a message, for example, The washing machine is ready!
And enter a title such as Washing Notification.
Click on Save and give your automation a name. I call this Washing Machine: Handle states
So, your automation is now ready! If your washing machine uses less than 3 Watt for 3 minutes, a message will be sent to your phone. You can also have a message broadcast through your smart speakers or have all the lights in the house flash red, or send the message to your wife’s phone (which is the best option), or all at once. Anyway, you get it.
I’ll leave that to your own creativity
It’s great that you now get a message on your phone, but it’s even more fun if you can follow the progress of your wash on a dashboard! Let’s build that!
Step 3: Make a Washing Machine Dashboard to monitor the Washing Machine!
The dashboard I’m going to create shows a few things:
- Current consumption
- The washing machine start time
- The washing machine end time when the laundry is done
- The expected end time of the washing machine while the wash is running.
- The amount of time left for the washing machine to finish the wash.
- A graph showing the power used.
- A graph showing the energy used.
For this, we need a few Helpers and a Custom Template sensor.
You can download all the code that I created for this video via the download link in the description below. Downloading is free, but you can also choose to make a donation just before you download the code. Please consider sponsoring me if my work saves you time. This way you support me so that I can continue to make these videos for you.
Set up the Helpers
We need 4 helpers.
To create a helper, go to Settings-> Devices & Services
Click the Helpers tab and click Create Helper
I’ve already made the helpers, so I’ll show them now.
The first Helper
The first helper is the Washing Expected Runtime helper. This stores the expected time that the washing machine will run.
What I’m going to do later is that I calculate this by taking the difference between the start time and the end time of the last run time. This is a very rough estimate and will not always be correct because every wash is different in terms of weight and washing program. But it gives a bit of an idea of โโthe time it takes for your laundry if you always use the same wash program with about the same weight of laundry.
This helper is of type number. What is important is that you set the Maximum value to a very high number. For example 1 billion.
The expected runtime is expressed in a timestamp, which is why I’m entering such a ridiculously large number here.
The second Helper
The second helper is a date-time helper that stores the expected end time when the wash is done. This helper is called Washing Expected Time To Stop and the input type is date and time.
The third Helper
The third helper is the Washing Started helper. This saves the date and time as soon as the washing machine starts.
The fourth Helper
The fourth helper is the Washing Stopped helper. It stores the date and time once the washing machine has stopped.
With the help of these helpers, we can monitor the washing machine and see when the wash has started, when the wash has stopped, and when the wash is likely to be finished when it is running.
I need your help!
You will be doing me a huge favor if you subscribe to my channel if you haven’t already. And, you will help me a lot if you also give this video a thumbs up and leave a comment. This way, YouTube will present this video to new people, making the channel grow! In the video description, you will also find information about how you can sponsor me so that I can continue to make these tutorials for you.
Thank you!
Creating the Template Sensor to monitor the washing machine
But I wanted to be able to see one more thing and that is the time remaining before the laundry is ready. I created a template sensor for that. If you want to create your own template sensors, make sure you add a line to your configuration.yaml.
To edit these you need the file editor or studio code server. Go to Settings->Add-ons and click on the add-on store. Search there on File Editor or Studio Code server and install one of these two. I use studio Code Server myself.
Open Studio Code Server and on the configuration.yaml within Studio Code Server.
Make sure the following line is in your Configuration.yaml:
template: !include templates.yaml
Also create a new file called templates.yaml.
In the templates.yaml add the following code. You can retype this code, but you can also download this code via the download link that you will find in the description. Again, downloading is free, but I’d really appreciate it if you’d make a small donation towards all the work I put into this. You can do this on the page where you download the code.
The template code calculates based on the values โโin our helpers how much time the washing machine needs before it is ready.
Once you have entered this code in the templates.yaml, save this file and go to Developer Tools, click the Yaml tab and click the Template Entities link. This will read the templates.yaml into Home Assistant again and your code will become active.
You can check this by going to the States tab and clicking Set State. There, select your new entity Washing Machine Expected Time Left.
You should now see a value there. It doesn’t matter what value that is because we’re not done yet.
Adjusting our automation to monitor the washing machine.
Now we have to adjust our automation so that all values โโof our helpers are filled.
Go back to Settings->Automations and Scenes and find the automation we created earlier.
Add a Trigger
We are now going to add a trigger that triggers when the washing machine turns on.
Click on Add trigger
Select Device
We choose our washing machine as a device
The trigger is again Washing Machine Power power changes
This time we enter 3 at Above and leave the duration at 0.
Now click on the three dots at the top right of the trigger
Click Edit ID and give this trigger the Trigger ID washing-started
If you don’t know how trigger IDs work, check out my video where I explain how trigger IDs work. You can find the link in the description below.
The trigger that we have now created will go off as soon as the power exceeds 3 Watts. That is when the washing machine really starts to run.
Add the actions
Now go to Actions.
These actions are quite complicated and I will show them step by step. You will also find this code in the download file.
The first action I created is an if-then action
Inside If I check for the trigger ID washing-started.
Then we go to Then.
Inside Then we do two things:
- We set the start time in our washing_started helper
We do that with a small piece of YAML in which the current time is put in the washing_started helper. This is done by adding the code Now(). This code will retrieve the current time. - In the second action, we fill our washing_expected_time_to_stop with a calculated value. That value is the current time plus the expected runtime of the washing machine that we calculate based on the previous wash. We use the value of our input helper washing_expected_runtime for this. The timestamp function converts the date and time to a format that we can use to calculate dates and times.
Then we go to Else.
At Else, we carry out the actions that have to happen when the washing machine stops.
- First, we send the message that the washing machine is ready. We’ve created that code before in this tutorial.
- Then we fill our helper washing stopped with the current time. Again, we use the now() function here.
- And then we calculate the difference between the time the washing machine started and stopped and store that time in our washing_expected_runtime helper. So, we get the values of our helpers washing_stopped and washing_started and subtract the two.
Step 4: The Dashboard
So, everything is now prepared to create our dashboard so that we can monitor the washing machine.
I made the dashboard quite intelligent and it will take too much time in this tutorial to explain it fully.
It is best to download this via the download link in the description, but I will briefly explain how it works exactly. You do need some HACS integrations for this to work.
So first install the Mushroom cards and the State-switch integration in HACS.
The mushroom cards are needed to make the interface look the same. I use the state switch integration to show or not show certain cards based on a certain status.
Dashboard structure
I have divided the dashboard into 5 blocks:
- The title
- A card showing the current washing machine power
- Two cards within a grid card showing the start time and end time of the washing machine. The end time is only shown when the washing machine is ready. As long as it’s spinning, you won’t see that card.
- Two cards within a grid card show the expected finish time and the expected time remaining until the end of the wash.
These cards are only visible when the washing machine is running. And the card showing the expected time that is still needed is only shown if that time is longer than the time that has already passed. - And lastly, I show two graphs showing the power and energy consumption.
Please let me know in the comments if you’d like to know more about how I created the cards to show based on certain statuses. I’ll make a video of that if enough people are interested in it.
And with this, we made our dumb washing machine a little bit smarter and you can monitor your washing machine!
I hope this video helped you and I want to thank everyone who has supported me in making these videos and tutorials so far. I could never have done this without you. Thank you! You can support me through Patreon, Ko-Fi, or by joining my channel. If you also want to support me, look in the description of this video for the links. With that, you make it possible that I can continue to make these videos for you.
Oh, don’t forget to give this video a thumbs up, subscribe to my channel, and hit the notification bell.
I will see you soon!
Bye bye!