This is the automation I made to control the state of the most power-hungry appliances in my house.
There arenāt numerous blueprints that do what I want, and Iām sure that I have the skills to automate my machines without wasting money to buy them new. Hereās my cheap and reliable solution that addresses the problem, once and for all.
I use this for my dishwasher and washing machine and the results have been great! The blueprint is very extensible and easy to use.
My family s this thing! Even if they donāt understand its complexity and get what all the fuss is about.
As I said, Iām sharing this with everyone. Iām sure that youāll find it useful!
Features
For the record: there is more inside but, hereās a summary of what this thing allows you to do:
- More triggers: more control, even across Home Assistant reboots!
-
This automation is triggered on each power reading. Iām doing the starting/finishing thresholds magic in the āactionsā section, and you can also add some of your own.
The objective of this blueprint is to allow more granular control over whatās happening and do that reliably.
-
-
Faster machine start-to-finish detection: one of the problems that I always face is timing. What if you want to measure how long it took for your appliance to complete its job? The automation has to be very reactive. This logic should solve that problem for you.
-
Unreliable power absorption filtering and inhibition: This is useful! It prevents the blueprint from thinking that a job was completed as soon as the power falls below the finishing power threshold. You can set your timing here.
-
Set your custom actions for each of the following conditions:
-
when an overload occurs
-
when the overload situation is solved, now paused
-
when the appliance is plugged back in, now paused
-
when the overload situation is solved, now resuming
-
when a new job cycle begins
-
when a job cycle resumes
-
when a job cycle is finished
All of these are optional!
-
-
The appliance has its own State Machine
-
So that you can tell if itās in one of the following states:
-
unplugged - The appliance is no longer powered. It happens when the user manually turns off the smart socket (from HA or the socket itself).
-
idle - There is no pending job, the machine is powered but idling.
-
paused - Indicates that a job is pending (incomplete cycle) but the appliance is not performing it. The inhibitors of these state are the datached_overload and unplugged states. In this condition, the power consumption is lower than the finishing power threshold. The appliance must be off (maybe the user turned it off manually or maybe the job needs some time to recover). The blueprint is waiting for the appliance to resume.Pro Tip! You could also use this to diagnose and warn if a job is not resumed after x minutes.
-
detached_overload - This happens when, during a cycle, the appliance used too much power and was therefore suspended. It is also technically unplugged.
-
job_ongoing - Triggered in two cases:
- when a new job cycle begins: the previous one is completed and the Starting Power threshold is surpassed.
- when a job is resumed.
-
job_completed - Triggered when the current incomplete job cycle is finished. The appliance consumes less than the Finishing Power threshold (also with the possibility of selecting for how long)
-
Note: Each state transition is handled automatically, you just have to provide the initial configuration.
-
Letās install it!
Requirements: What do I need to run this blueprint?
To achieve this level of control the socket must have some basic features:
- Power monitoring (a polling rate of circa 60 sec. or less for best results)
- ON/OFF control over HomeAssistant
- State reporting (if itās ON or OFF)
Mine is a Meross MSS310EU, but most smart sockets should be supported.
One more thing:
- OPTIONAL: To get the pause state to work properly, you also need another automation that can detect an overload. Iām not the author of any of that, but the one Iām using is here (disclaimer: itās just in Italian ).
Initial Setup: Letās make some helper variables (mandatory!)
There are two possible ways of doing this:
-
Setup via the UI [Discouraged but Beginner Friendly]: newcomers that might be a little bit into shiny-but-dark UIs might want to set up this blueprint following this documentation here.
ā¦
-
Setup via the old school YAML [Optimal & Suggested]: The best way of creating what we need is to create a package (suggestion provided by @HollyFred) because it allows us to create all the necessary helpers (timers, input_booleans, etc) in one shot. Continue reading for this one
Creating a package is super easy. Some of you may already have the right configuration in place, but Iāll show you how to do that anyway.
Note: you need to have the VScode integration enabled. This will allow you to manually edit the necessary files. Need help with that? Read this.
Back to us, here are the two steps for creating a package:
-
Make sure that you have a directory called āpackagesā.
If you are a beginner or you are starting fresh with your HA installation, likely, the
packages
dir is not present.To add it, you can:
Open your HomeAssistant VSCode editor and create a directory called
packages
(at the same level as the configuration.yaml file).OR
Issue this command in the terminal section of your VSCode:
cd /config && mkdir packages
easy peasy.
Result: You should see the packages directory at the same level as the
configuration.yaml
file. -
Make sure that the packages support is enabled inside of the
configuration.yaml
file as shown below:homeassistant: ## Packages support enabled - Includes every package that is inside the packages/ directory packages: !include_dir_named packages/
Now we are ready to create our first package.
Open the packages/
directory and create a file with the name of your appliance.
For example, Iām calling mine washing_machine.yaml
but yours could be different. Itās always better to call it something like <your_appliance_name>.yaml
PRESETS - If want to simplify this even more, check out one of the already pre-made packages I prepared for you.
Remember that in order to use the blueprint youāll always need these four ingredients inside a package (like so):
A. The State Machine
input_select:
<your_appliance_name>_state_machine:
name: <Your Appliance Name> - State Machine
options:
- unplugged
- idle
- paused
- detached_overload
- job_ongoing
- job_completed
icon: mdi:<your_appliance_icon>
B. The Job Cycle indicator
input_boolean:
<your_appliance_name>_job_cycle:
name: <Your Appliance Name> - Job Cycle
icon: mdi:<your_appliance_icon>
C. The delay timer
timer:
<your_appliance_name>_delayed_job_completion_timer:
name: <Your Appliance Name> - Delayed Job Completion Timer
duration: "00:15:00" # <- Note that the time here. Leave it 15 min
restore: true
icon: mdi:<your_appliance_icon>
D. The automation self-trigger
input_boolean:
<your_appliance_name>_automation_self_trigger:
name: <Your Appliance Name> - Automation Self-trigger
icon: mdi:<your_appliance_icon>
Important! Donāt forget to edit all the fields <your_appliance_name>
, <Your Appliance Name>
and <your_appliance_icon>
accordingly.
Download & Import
Are you trying to update to a newer version? Letās do that in a snap! Follow this guide.
If you have just created your package, please reboot Home Assistant (at this page ā Verify & if okay, Reboot)
- Add this blueprint to your Home Assistant
- Create a New Automation from that blueprint
- Configure the variables as indicated inside the blueprintās UI.
Thatās it!
Results
You should see the 4 new entities:
Warning | always use those entities as indicators, do not change their values manually! Leave that to your automation
Washing Machine entities
ā¦
During a job cycle:
This is my washing machine. Power usage example
ā¦
The State machine. The one in light blue is a simulated overload situation.
Congratulations! Your appliance is now smarter
___
Versions & Changelogs:
Important notice!
The code has been updated
-
Version 2.1.1 of 07/21/2022 - [FIX!]
- Fixed this bug:
Description:
When you donāt indicate the Appliance suspended entity - which I marked as optional - the automation becomes unresponsive, thus making the optional value a required one.
- Added some new documentation. You can decide to make your helpers through the UI instead of VSCode.
- We are now using packages instead of overloading the configuration.yaml file with the helpers.
GUIDE: Are you trying to update? Follow these instructions.
- Fixed this bug:
-
The changes related to the older versions are shown here.
The code of this blueprint is also available on my GitHub, and on leofabri.com.
ā¦