šŸ”Œ Detect and monitor the state of an appliance based on its power consumption - V2.1.1 - Updated!

Hey @dirtdagg! I didnā€™t design the automation to work without the ON/OFF switch control, and the current logic is using that piece of information here and there, so I would say itā€™s mandatory. Iā€™ll review this request for the next version, but itā€™s required.
You could definitely bypass that entity by creating a helper switch that could simulate the socket control via software.

1 Like

Thanks, man :grinning:! I did consider including the creation of helpers through the GUI in the documentation, but that would take longer to explain. Copying and pasting my configuration seemed the more appropriate solution back then. Iā€™ll definitely add that now that I see interest.

Please make sure that your timerā€™s duration is set to 15 minutes even when using the GUI. You can then define your custom delay through the automationā€™s config.


Yeah, I that behavior in your graph. There are a lot of dips! Exactly, try setting your Delayed Job Completion to maybe 1 minute or less. According to my tests, it should work. You may also have to play with the starting and finishing threshold a bit to get this right :wink:

Thanks for your reply! I think adding the GUI option also makes it easier for the ā€˜new generationā€™ of HA users who are not comfortable with editing configuration files. I donā€™t mind editing the configuration file, but I rather do it through a GUI because it feels more idiot-proof.

Iā€™ve had a play around and changed the power plug that has been measuring the energy use to see if that would make a difference. Iā€™ve changed it from a TuYa TS011F_plug_1 to a TuYa TS011F_plug_3. That actually made quite a difference. The plug_3 reports based on polling because itā€™s supposed to be broken. That apparantly smoothes out dropping to 0Wā€¦

Hi, very interested in using this, are there any plans to incorporate the state of a second appliance?

e.g; Donā€™t announce that the washer has finished, if the drier is still active

Then, when the drier has finished, announce both.

Thanks
Alan

Hi Alan! the blueprint was made with the goal of controlling each individual appliance, so sorry, but no, I have no plans for that. The blueprint itself is already very articulated but modular. Such an addition would be cool but perhaps ā€œunnecessaryā€ to most users.


You can still achieve what you want by combining the two automations together: one for the washer and one for the drier.

Instead of announcing that the job was completed straight away when an appliance is done, you could play with the customizable ā€œAction(s) when a job cycle is finishedā€ section of my blueprint, so that you check if the washer / the dryer is still performing a cycle, and then choose when to announce what, for both.

This could be a raw implementation of your request:

- ā€œAction(s) when a job cycle is finishedā€ on the dryer automation (YAML code).

Note: Change the entities accordingly as they might have a different name.

    actions_job_cycle_ends: # <- This is a custom action. After you've set up the blueprint (follow the documentation), you'll see the "Action(s) when a job cycle is finished" section. This is its corresponding yaml configuration
      - if:
          - condition: state
            entity_id: input_boolean.washing_machine_job_cycle # Your wahing machine job cycle indicator (coming from the other blueprint)
            state: 'off'
        then:
          # Do something. I'll send a notification. This is just an example
          - service: notify.mobile_app_<someone's_phone> # For example: send a notification to a phone
            data:
              title: Washing & Drying Job completed
              message: The job was completed on both the dryer and the washing machine
        else: []

- ā€œAction(s) when a job cycle is finishedā€ of the washing machine automation (YAML code).

Note: Change the entities accordingly as they might have a different name.

    actions_job_cycle_ends: # <- This is a custom action. After you've set up the blueprint (follow the documentation), you'll see the "Action(s) when a job cycle is finished" section. This is its corresponding yaml configuration
      - if:
          - condition: state
            entity_id: input_boolean.dryer_job_cycle # Your dryer job cycle indicator (coming from the other blueprint)
            state: 'off'
        then:
          # Do something. I'll send a notification. This is just an example. 
          # Note that this part is the same on both
          - service: notify.mobile_app_<someone's_phone> # For example: send a notification to a phone
            data:
              title: Washing & Drying Job completed
              message: The job was completed on both the dryer and the washing machine
        else: []

A few notes about this:

I made this example to show you how you could achieve that. Itā€™s actually very straightforward and definitely possible. Please note that there are limitations. The biggest one in my opinion is that you may not have the washer running at all but the notification would mislead you into thinking the opposite. Also, the notification isnā€™t aware of the past.

Why to add the logic to both, you might ask. Well, what happens if the washer finishes before the dryer? The above conditions would have to be placed on both the automations so that the appliance that ends first is the one that sends the notification.

Please let me know if you need more help. Have a great day :wink:

FIXED ā†’ :bug::x: NEW BUG DISCOVERED - 07/15/2022 :x::bug:

Hello folks!! Hope you are all enjoying the blueprint.
Today Iā€™m reporting a nasty bug in the configuration.
It only happens when you donā€™t indicate a Appliance Suspended entity (which I indicated as optional). When this condition is met, the automation becomes unresponsive and no longer indicates when the socket is unplugged.

A small and almost untraceable error is shown:
> Error: In ā€˜notā€™ (item 1 of 2): In ā€˜templateā€™ condition: AttributeError: ā€˜listā€™ object has no attribute ā€˜lowerā€™

This behavior is not wanted and will be fixed very soon in the next release.
If You are experiencing the problem, the only advice I can provide at the moment is to create a dummy input_number that will indicate a value of 0 and assign it to the Appliance Suspended entity* entry in the visual configuration of the blueprint.

1 Like

07/21/2022 - Version 2.1.1 has been released!

The code has been reorganized and some bugs got fixed :wink:

Follow the guide to update to the latest version.

1 Like

Some links were dead, I went through each one of them to make sure that they work.

Now, they seem to be doing their job! Nice :slightly_smiling_face:, sorry for the delay

Hey Leo,

Iā€™m giving this a test run and I noticed that mine stays in ā€˜job_ongoingā€™ and never kicks over to complete.

any thoughts on what might be causing this? Here is an output of the trace.


Hey hi! Unfortunately, I am unable to see anything wrong without additional information.

It could be that the finishing power threshold is not reached, or maybe, you may have set your time to a value that is too big and the sensor might be reading values that are > the finishing power threshold during that period. All appliances are different, and finding the right value could be hard sometimes.

What I need to help you is:

  1. The blueprint config (you can see that there is the section in the 2nd image you attached). Copy and paste it here in the forum
  2. The graph of the power consumption of the appliance during the cycle. Please take a screenshot
  3. More? Weā€™ll see
id: '1658693952680'
alias: Washer 2.o
description: ''
use_blueprint:
  path: leofabri/appliance-status-monitor.yaml
  input:
    appliance_socket: switch.washer_power
    appliance_power_sensor: sensor.washer_power_electric_consumption_w
    appliance_state_machine: input_select.washer_state_machine
    appliance_job_cycle: input_button.washer_job_cycle
    delayed_job_completion_timer: timer.washer_delayed_job_completion_timer
    automation_self_trigger: input_button.washer_automation_self_trigger
    actions_job_cycle_ends: []
    appliance_finishing_power_threshold: 2

Let me know if anything sticks out at you!

Thanks!

I wasnā€™t expecting the graph to look like that, this is quite extreme. I love it!

I suspect that the appliance_finishing_power_threshold is never reached (because the power consumption stays above 2 Watts all the time). I might be wrong. But I canā€™t tell because the graph is not that detailed.

  • What is the power consumption of your washer in idle? Letā€™s sayā€¦ at 11:24
  • Is this the latest version of the blueprint? V2.1.1

I can confirm that this blueprint runs flawlessly for my appliancesā€¦ there must be something off here

I was thinking the same thing, but at at 11:24 itā€™s .99 -.93 (it looks like it fluctuates a bit).

Then at 1:15 it does the same thing fluctuates between 1.09 - .99

Iā€™m running 2.1.1

Iā€™m still working on troubleshooting this, and one thing I noticed is that the Washer - Job Cycle button is/has been in an unknown state the whole time. Should something be happening tot hat button to trigger the on/off status of job_ongoing?

Hi @csjo, sorry for the late reply. What you are telling me now is not something of concern that should happen.
The input_button.washer_job_cycle is a fundamental part of the automation because it canā€™t work without it. Since itā€™s an input_button and a helper, the possible states are 0 or 1. Unavailable is not contemplated.

  • How did you create that helper entity? Was it through the .yaml packages or the UI?

If you did it with the packages method, your config should be:

# ...

input_boolean:
  washer_job_cycle:
    name: Washer - Job Cycle
    icon: mdi:washing-machine

# ...

Also, that button is used internally. You should never change that, as the automation needs to take care of it assigning it a value based on the status of the appliance. But the initial state cannot be unavailable

Hi, I created it via the gui. Here is a screen shot of it.

Oh no, itā€™s my fault! :sweat_smile:
In the documentation for the UI I wrote ā€œButtonā€ but the thing we need is actually an input_boolea, which in the UI is called Toggle. Itā€™s quite unclear to me why they called it like that.

To fix:

  1. Please delete the input_button you showed to me in the last pic
  2. Create a Toggle instead. Call it Washer - Job Cycle, and then pair that entity in the automation
  3. It should finally work
    UPDATE: 4. Please do the same to the input_button.washer_automation_self_trigger entity. It has to be a Toggle (input_boolean) as well

Such a small mistake made this unusable. Iā€™m so sorry about that. Iā€™m updating the documentation

Awesome! the state is now Idle so that looks to have fixed the issue. Iā€™ll give the machine a test cycle and see how it handles.

I appreciate your time!

1 Like

I canā€™t tell you how many attempts Iā€™ve mad at something like this, from doing it myself to using other peopleā€™s solutions, and Iā€™ve been frustrated with success. I installed this last night and have done a test run on my washing machine andā€¦it just works. My machine used to trip up other integrations as even in standby it would fluctuate between 0w and about 5w (no idea why, seems a waste of electricity to me) which would cause the status to fluctuate between ā€œrunningā€ and ā€œfinishedā€. With minimal effort, your solution appears to have worked first time.

Iā€™ve also set up a dishwasher which I will test tonight and a tumble dryer. The latter is proving diffucult as it has an anti-crease cycle at the end which runs for about an hour which to my horror I spotted uses over 200w during each cycle (so the machine cycles between about 4w and about 200w until the machine is turned off OR the anti crease cycle times out at about one hour). Iā€™m not sure if I can do anything about this but to be fair this is a ā€œsmartā€ tumble dryer anyway so I can hook into the Home Connect integration to get the actual status - I just wanted all three appliances to use the same logic.

EDIT: great work BTW!!

1 Like

I have following error after copying the washing_machine.yaml file to package folder, before restart

"Configuration invalid!

Error loading /config/configuration.yaml: mapping values are not allowed here
in ā€œ/config/packages/washing_machine.yamlā€, line 28, column 66"
I have no knowledge of this coding, can anyone help