leofabri / hassio_appliance-status-monitor

🔌 Detect the state of your appliances based on their power consumption ✨
245 stars 18 forks source link
automation home-assistant home-automation homeassistant state-machine

🔌 Detect and monitor the state of an appliance based on its power consumption - V2.1.1 ✨

Automation Blueprint for Home Assistant


Monitor the state of an appliance - by leofabri

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 ❤️ 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:


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:

Mine is a Meross MSS310EU, but most smart sockets should be supported.

One more thing:


⚙️ Initial Setup: Let's make some helper variables (mandatory!)

There are two possible ways of doing this:

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 VS Code 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:

  1. 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 VS Code 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 VS Code:

    cd /config && mkdir packages

    Easy-peasy.

    Result: You should see the packages' directory at the same level as the configuration.yaml file.

  2. Make sure that the packages support is enabled inside the configuration.yaml file as shown below:

    homeassistant:
      ## Packages support enabled - Includes every .yaml file that is inside the packages/ directory
      packages: !include_dir_named packages/
      ## Warning! Please pay attention to the indentation!

Now we are ready to create our first package.

Use the presets

PRESETS - If you want to simplify this setup even more, check out one of the already pre-made packages I prepared for you. (Washing Machine, Dryer, Dishwasher and more are already supported)

Alternative, custom package definition:

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. Here's a blank file for that.

Remember that in order to use the blueprint you'll always need these four ingredients inside a package:

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)

  1. Add this blueprint to your Home Assistant Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.
  2. Create a New Automation from that blueprint
  3. 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

my alt text

Washing Machine entities

During a job cycle:

power usage example

This is my washing machine. Power usage example

appliance history image

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

  1. 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 VS Code.

    • We are now using packages instead of overloading the configuration.yaml file with the helpers.

  2. The changes related to the older versions are shown here.

How do I know if there is a new version?

Easy! Look for the current version number in the title. Now, open one of the automations that currently uses this blueprint and notice the version tag:

Do I need to update?

How to update:

  • Open this page Open your Home Assistant instance and show your blueprints. (just click the link, it's magical) and scroll till you find "Monitor the status of an appliance - by leofabri" and delete it by clicking on the trash bin 🗑. Don't worry, we'll add it right back in a few secs, you can leave the automation as it is for now.
  • Create the missing helpers (entities) as shown in the instructions
  • Add the blueprint again Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled. and reload Home Assistant.
  • Open your automation and add the previously created helpers (entities)

Q&A - Things you may want to know

See the dedicated documentation