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

Was thinking maybe we could have some way to tell the blueprint what the estiimated times for all modes of the washer should be. mine has 5 modes and it displays the runtimes of each when selected. perhaps it could use this relevent data to build a delay to only probe past a certain time limit based on what it knows to expect.

Thanks very much for this brilliant Blueprint! Iā€™ve been waiting for V3 to be released, however I was keen to start using this so Iā€™ve jumped in and started using V2.1.1 today.

Iā€™ve set things up correctly, as far as I can see, however after 2 tumble dryer cycles, I am not getting the state machine changing from ā€˜job_ongoingā€™ to ā€˜job_completedā€™ as I expected:

Iā€™ve set the starting power threshold as 5W, the finishing power threshold as 500W, and the delayed job completion duration as 300 seconds.

Iā€™m expecting the state to change to ā€˜job_completedā€™ once the power drops to below 500W for 5 minutes, however it remains as ā€˜job_ongoingā€™? Iā€™m obviously doing something wrong so would appreciate a little guidance please! Thanks

EDIT: It seems the ā€˜Delayed job completion timerā€™ keeps continually refreshing and constantly showing 15 minutes remaining, with an ever increasing ā€˜finishes atā€™ time??

image

Iā€™ve finally received my ā€˜job_completedā€™ status!

This has come 15 minutes after the last bit of activity from the dryer. The activity you can see in the graph from 19:15 onwards is just the dryer turning the clothes every so often, as an anti-crease function, with no heat, which is why it only uses approx. 170W of power each mini cycle.
Seeing as the power had dropped below 500 watts for 5 minutes, between 19:15 and 19:20, thatā€™s the point I expected the job to show as complete. This is the point I want to go and turn the machine off to save the constant anti-crease function and get the clothes in. This anti-crease cycle lasts for an hour before these is no further activity from the dryer and the power stays at zero.

Looking at the state of the ā€˜delayed job completion timerā€™, itā€™s clear that these anti-crease cycles are resetting that 15 minute timer each time they occur:

How can i prevent this?

@leofabri - I wondered if you might be able to shed any light on what might be going wrong with my state machine above please?

You might be interested in hearing that Iā€™ve finally got my little automation situation resolved, @leofabri, but itā€™s a bit convoluted. It starts with the script that turns on another script, and plays a notification over my speakers that the laundry is done, and to flip it over. An automation checks for the job_completed status AND that the script has run, and repeats an action (a different notification over the speakers). This was where I was getting frustrated earlier, because opening the lid (and setting off the contact sensor) never seemed to stop that automation. So I now have an additional automation that checks to see if that lid contact sensor has been open for at least 2 minutes. If it does, it stops that first automation. As I said, convoluted, but itā€™s working, at least.

Iā€™m running the 3.0 dev version and it is working great for my washing machine! Thank you for all the work this.

I do have two feature requests:

  • It would be great if as an alternative to the Job Completed/State Persistence Timer, I could specify a door sensor. When the door sensor is specified, remain in job_completed state until the door opens, and once it opens then transition to idle.

  • It would also be cool if there was a way to set a recurring reminder while the appliance is in job_complete status - for example, have an action fire every hour to nag to collect the clothes/dishes. This would work great with the door-sensor-transition-to-idle feature aboveā€¦

Regardless, thanks again for the work on this. I really appreciate it.

1 Like

I have been thinking about adding such a feature for a while. I think Iā€™m soon going to buy a hall sensor and test if something like this can be achieved in a reasonable amount of time (sorry guys, Iā€™ working on my degree at the moment).
Do you have any sensor to suggest?

1 Like

I just use simple Aquara door sensors attached to the washer and dryer doors, but really any will do.

As an update, I decided to fork your code and take a crack at this myself as a learning exercise mostly. You code is very well done and I learned a lot from it about how choose clauses work. The results came out pretty well:

This version uses the door sensor to do a couple of things:

  • If a job is actively running and the door opens, it moves the state machine to Paused. Note, I removed the support for Overload status tracking because Iā€™ve never had an issue with that and I wanted to simplify things somewhat. Your code already moved the state machine from paused back to running when power level increased again and this seems to still work fine with this approach to pausing.
  • If a job is completed it will sit in the completed state until the door opens. Once the door opens it will transition back to idle. This is similar to how Phil Hawthorneā€™s appliance tracking logic worked and makes a ton of sense for washing machines, dryers, and dishwashers (maybe less so for other appliances?)

I also realized after posting that the notification duties (including the nag) are better handled in a different automation. I havenā€™t decided if its better to trigger it from your custom actions option or from just triggering off state machine changes, but Iā€™m leaning toward the custom action to reduce the change of false positives.

To anyone else reading along, please note that my fork is NOT SUPPORTED, and is not intended to replace leofabriā€™s work. It is just my attempt at solving a problem and an excuse to learn more about HA template development. Iā€™m sure there are things wrong with it for scenarios that donā€™t match my extremely limited testing.

Again, thanks for your work on this automation template, and best of luck with your studies!

5 Likes

Here is another fun addition to the project. I wanted to be able to show how long an appliance job had been running in the UI. You can add this sensor template to the package: file (in this example, the washing_machine.yaml package):

template:
  - sensor:
      - name: Washing Machine Job Elapsed Time
        state: >
          {% if is_state('input_boolean.washing_machine_job_cycle', 'on') %}
            {% set hf = ((now() - states.input_boolean.washing_machine_job_cycle.last_changed).total_seconds() / 3600 ) %}
            {% set h = hf | int %}
            {% set m = ((hf - h) * 60) | round %}
            {{ '%s hour' % h if h > 0 }}{{ 's' if h > 1 }} {{ '%s minute' % m if m > 0 else 'less than a minute'}}{{ 's' if m > 1 }}
          {% else -%}
            off
          {% endif %}

and that will update once a minute with the elapsed time while the job is running. Template sensors are neat.

6 Likes

I have a timer for cycle end for my washing machine, itā€™s about 5mins(it had to be that long)
However, sometimes weā€™ll switch off the power after washing machine is finished, but before timer expires. In that case, state machine will be ā€˜job ongoingā€™ as power sensor will go to ā€˜unavailableā€™. Can I somehow use those 5mins OR sensor goes to unavailable for cycle end?

Iā€™m loving this automation, thanks for this.
@millercentralā€™s version got me thinking however, that I would like to match washing machineā€™s actual states more closely, not just unplugged ā†’ idle ā†’ job ongoing ā†’ job completed / idle

It would be helpful for us to expose the following states:

  • off (as opposed to unplugged): 0 W - dial is set to off
  • idle: 1 W (or less than 4 W at least) - dial is set to a program but no active job
  • timer (or using pause even): 4 W - manual delay for cycle start of 3, 6 or 9 hours.

Sometimes we mess up the timer, so be nice to be able to double check, or a few times washing machine has cancelled the timer for no obvious reason, so itā€™d be helpful to be notified if that happens.

What would be the most viable approach to allow extending the system to extend / add further states for different power thresholdā€™s ?

Thank you for the amazing job @millercentral. Hopefully, after yesterday, my studies mostly completed (the thesis is the only thing left).
Iā€™ve spend a lot of time away from the HA community, and my personal environment for testing this automation and the other thing has been left behind of many versionsā€¦ I would like to continue the work on this automation.
Iā€™m reviewing what youā€™ve changed. Please let me know if we can implement some of your recent additions to the main code. I would love this to be a collaborative project, feel free to get in touch if you want to join some of the changes to the main repo.

1 Like

I initially decided to use the ā€œunpluggedā€ state to better reflect the fact that the appliance is actually not plugged but I think that off could be a valid option if we want to increment the abstraction a bit more. One more thing, how could we detect if the appliance is set to have a manual delay for cycle start?

Sometimes we mess up the timer, so be nice to be able to double-check, or a few times the washing machine has canceled the timer for no obvious reason, so itā€™d be helpful to be notified if that happens.

Yes, this would be a nice addition.

What would be the most viable approach to allow extending the system to extend/add further states for different power thresholdā€™s?

Unfortunately, Iā€™m afraid itā€™s not as easy as adding some additional states to the state machine. First, we need to be able to determine if the additional states can be recognized based on a previous state or from the data of the smart socket.

One more thing to mention is that I usually try to make every update as lees breaking as possibleā€¦ Iā€™m sure people already hate the way we have to update blueprints. Iā€™m trying to keep it easy for everybody. Changing the states is a big change

hi @leofabri, hi all,
I love this blueprint, it makes dealing with dishes, clothes and even coffees far easier.

for one minor challenge I might need your advice or even an extension of the blueprint.
When I am not immediately getting the clothes out of the washing machine when it has finished, it switches off. To open the door, I have to switch it on again. And the automation detects an additional cycle. I switch off the machine immediately after I have opened the door, and the cycle ends. and I get the message that a cycle has ended.

Similar story for the coffee machine, when I switch it on, the automation detects it and starts a cycle. Sometimes I forget to start the the creation of the coffee and the machine switches off. nevertheless it informs me that the cycle has finished and ā€œthe coffee is readyā€.

What I would need is to set a minimum duration of the power being above the configured threshold.
e.g. in the case of the washing machine, 3min.

I hope I could get my challenge and wish across.

Hi @leofabri,

This blueprint seems incredibly useful in our household where laundry often ends up forgotten.

Iā€™m running into an issue where it seems to a bit too well. Our dryer starts a ā€œreduce wrinkleā€ program after the real program has finished. As a result the job_complete state gets triggered roughly every 2 minutes. The power usage drops to around 2 watts at the lowest and spikes to 130 momentarily. During this extra program Iā€™d like to consider the job done.

Is there any way to accomplish this?

Just set ā€˜Finishing power thresholdā€™ to, say, 3?

finishing power threshold is currently set at 3.

What happens is that the dryer stays in a low power mode and occasionally spins up. Only when we manually turn off the dryer, does the power usage drop to 0. Every spike is currently detected as a new cycle.

Is it possible to set the minimum duration to consider it a proper cycle? Eg: if the power usage is above the starting threshold for more N seconds, transition to job_ongoing.

I see. Whatā€™s your Starting power threshold? From the pic you attached previously it seems like you have a spike to around ~200W when the cycle starts - why donā€™t you use that as starting power threshold?
That way these small spikes wonā€™t count as a new job, as they are <200W.

Clever! I think should work.

Power hover around a 100 for about a minute before increasing. So a higher starting threshold should work as expected, albeit with a slight delay. Though I donā€™t think that really matters for my use case.

Hello again :slight_smile:
does anyone have an idea for my challenge to define a minimum duration of the power being above the configured threshold?

Cheers