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

After some use of this automation with my dishwasher, I have a suggestion for you.

I found that when the washing cycle is completed, my dishwasher however still mantains a certain stable low power consumption level as it’s still on, until it’s physically turned off.

Unfortunately, as expected, similar low power consumption levels occur sometimes for brief periods (a few minutes) during the cycle.
This could be overcome setting a “delayed Job Completion duration” value, but this causes the side effect of a delay of many minutes before the automation is allowed to detect a job completion.

In my case, but the same might be valid for other types of appliance, the cycle duration is actually almost fixed, as my dishwasher always runs the same program.

So my suggestion to improve the automation would be to add a further optional parameter called something like “After job started do not check job completion before:” with a value in minutes (default 0 min, i.e. not used).

In this case when the final power consumption falls under the selected threshold, the job completion state may be detected immediately without delay as the possible intervening power falls during the cycle are not taken into account.

Thanks for your nice work!

hi

thank you for this great blueprint. I was wondering if it is possible to have some kind of translation for the state of the machine. The reason is, we are native German speaking, and it would look better if the state would be e.g “fertig” instead of “job_completed” . Is this somehow possible?
Thanks
BR
Daniel

hi @andrus
I mentioned a similar idea/enhancement request:

it’s good to know that it’s not only me thinking about such an improvement.

Hi, @niknol, I have read your post, but if I understood correctly, you proposed a new ‘minimum duration of the power being above the configured threshold’, while I actually propose a new value (minutes) after the blueprint has detected a job_ongoing state, before which not to check for a job_completion state, regardless of any power level variation occurring during this interval, so the level could stay near zero even for many minutes during the cycle w/o triggering a job_completion state.

The reason for example a dishwasher is that its washing cycle never lasts less then a certain amount of time, so it’s safe and easier to ignore any power variation before this interval has expired.

This broken for me in the latest HA update - 2023.11

EDIT: It was my fault!

Yes, @andrus you’re right.
two different but a bit similar enhancements. @leofabri Perhaps they could be implemented in one go 


I have a water softener that’s got me stumped. It takes about 2.5 watts all the time. When it goes through a regeneration cycle, a valve opens, stays open for a few hours, then closes. You can see one of these regeneration cycles in the picture below on Nov 6 from about 12:30 AM to 3:30 AM as two spikes up to about 5.8 W.


It also has a built in light. When I open the lid to add salt, the light comes on and takes about 7.2 W, which you can see on Nov 7 at about 2:00 PM.
So the question is, how do I detect the regeneration cycles, but not the lid opening?

If you can do without the light, then, if possible, you could remove the bulb, or at least replace the light bulb with a LED one having a less power requirement. :thinking:

1 Like

I am about to start using your fab blueprint. Before I start, is version 3 (still in beta) the version I should use?

Just in case you still need this info:

Open your config file editor of choice, then check in folder “packages”, you will find a set of files for your appliances.
If you open for example “dishwasher.yaml”, scroll down to the end of the file and you should find something like this:

  - sensor:
      - name: Dishwasher Current State - Translated
        unique_id: dishwasher_current_state_translated
        icon: mdi:dishwasher
        state: >
          {%- macro state_machine_translation(state) -%}
          {% set STATE_MACHINE_TRANSLATION = {
            "unplugged": "Ausgesteckt",
            "idle": "Inaktiv",
            "paused": "Pausiert",
            "detached_overload": "Überlastung",
            "job_ongoing": "LĂ€uft",
            "job_completed": "Fertig",
          } %}
          {{ STATE_MACHINE_TRANSLATION[state]}}
          {%- endmacro -%}
          {{ state_machine_translation(states('input_select.dishwasher_state_machine')) }}

I’m using this blueprint for our washing machine but I keep running into some issues.

When it is finished the power usage peaks a bit when the machine tumbles the drum a few times until you open the machine. The fluctuations make it hard to determine the wattage that signals the washing machine is done, if I set it too low it won’t trigger, too high and it will keep on triggering while the machine is busy.

As a workaround I’m now using an average of the power usage for the last few minutes of the washing machine which I’ve created using the statistics integration. It is working as expected, after the machine is done the “average” sensor is reporting a steady 5-10 watts of power usage. But somehow the job_cycle helper is no longer switching to job_completed when the machine is done. Only after I’ve shut down the machine will the job change to completed:

A history graph of the statistics sensor I’ve created (wasmachine_gemiddeld_energiegebruik):

The blueprint config:

alias: Wasmachine cyclus
description: 
use_blueprint:
  path: leofabri/appliance-status-monitor.yaml
  input:
    automation_self_trigger: input_boolean.wasmachine_automation_self_trigger
    appliance_socket: switch.plug_wasmachine
    appliance_power_sensor: sensor.wasmachine_gemiddeld_energiegebruik
    appliance_finishing_power_threshold: 15
    appliance_state_machine: input_select.wasmachine_state_machine
    appliance_job_cycle: input_boolean.wasmachine_job_cycle
    delayed_job_completion_timer: timer.wasmachine_delayed_job_completion_timer
    delayed_job_completion_duration: 240
    appliance_starting_power_threshold: 5

The statistics sensor:

  - platform: statistics
    entity_id: sensor.plug_wasmachine_power
    name: "Wasmachine gemiddeld energiegebruik"
    state_characteristic: mean
    max_age:
      minutes: 3

What a wonderful piece of work! Thank you @leofabri for the countless hours you must have invested.

I’m experimenting with V3.0.0 because I need the timers.

It is working. However, there are errors in the log:

ERROR (MainThread) [homeassistant] Error doing job: 
Task exception was never retrieved  
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 444, in async_run
raise err

To provide some context, I set up the logger integration as follows:

logger:
  default: warning
  logs:
    homeassistant.components.asm_blueprint: debug

The log results for various experiments are here: https://pastebin.com/guJqnmm6

washing-machine _wit
tumble-dryer_wit
tumble-dryer
washing-machine

Have fun!

2 Likes

Wanted to try this blueprint today. I connected my plug to the socket, added my washing machine to the plug. Set up the helpers, added and configured the blueprint. I then set some wattages rules etc. All going well so far, it knows when it’s running or not.

But after like half an hour it stopped. The smart plug went to ‘off’ so my washing machine got cut off the power. In the HA logs there is nothing directly that caused it as far as I can see. The latest wattage was quite low, while the plug handled the 2200-2300W just fine, later when it returned to just a few watts, it just turned off. Any idea how that can be? I had it connected before and it worked fine without the blueprint.

Hi @leofabri, what might be a fun addition to your blueprint is adding an “unemptied” state that tells you the appliance needs to be emptied. This can be achieved by using a door sensor that detects if the appliance door is opened after the job is completed. This can then be used to for example send an extra message to your phone that you really need to empty the appliance after it is done for an hour or so.

For now I have a couple of automations that control my washer states and I would like to start using your blueprint, but I’m missing this extra state.

Please let me know if this is an option.

These icons look great, thanks! Can you let us know how to implement them?

1 Like

In the custom button card you can use this

  1. upload the gif icons to your www folder (if you don’t have a www folder, create it in the root of HA via File Editor plugin or Studio Code Server
  2. add this in the card after the entity:

show_entity_picture: true

  1. where you want the gif icon to show add this:

entity_picture: /local/wasmachine_3.gif

www == /local in the path, so don’t use www in the path, but /local

1 Like

@millercentral Just tried your 3.1.0, but it seems to always get “stuck” in a paused state when it’s finished. I have set the threshold to 18w and a delay of 300 seconds. Currently, it’s at 11 watts and have been for a while. Last time the ASM-automation ran was 24 minutes ago.

Any idea on how to debug this?

If I setup and use the optional HA_PowerControl addon, how does your blueprint get the pause state exactly? Just by changing the state or what exactly connects both of yours automations?

This is such an amazing blueprint. Do you know if the Govee smart plugs work with this?

" Govee Smart Plug with Energy Monitoring, WiFi Bluetooth Plug Work with Alexa and Google Assistant, 15A Smart Outlets with Timer & Group Controller, No Hub Required, ETL&FCC Certified for Home, 4 Pack"
https://www.amazon.com/Govee-Monitoring-Bluetooth-Assistant-Controller/dp/B0CKM8CF7N/ref=sr_1_7?crid=3KJ1DNRZUZII4&dib=eyJ2IjoiMSJ9.qCgj2Bb17juuzJMgAV5gPyId0IQOMJ6S-Kzr1eg1LNEqDdhc29Ps9IpYYLfcE8PJJn9_ZiYj53S69rCHABk4rULW8c13geNHZU1hXxrrYUAiNtbDEckWytIxrFEG6JsOYIb6R3kWObzE5N1o6ZTHlhoC8owjcRxz7oOE1e9ai166rRC6bIBVo4dX4j9H-oMupGPGgQMReC6QexXM14Z0osfWQmdlM2UFvgbi-xy1NHJLgoeRZzdW2df1V7rNCfjvVRvlzku8QTCqITUJd8HeKJ2YZxaSYGyYmxGR4flq4ME.C7mEzovkISBmunwti0r0OKml5BwLuQ0ZmgMlwA_h460&dib_tag=se&keywords=wifi%2Bsmart%2Bplug%2Bwith%2Benergy%2Bmonitoring&qid=1718451467&sprefix=smart%2Bwifi%2Bplug%2Bwith%2Bener%2Caps%2C111&sr=8-7&th=1

Thanks.