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

Absolutely!

Hello,
i have started using this Blueprint shortly and its been working great for a washing machine. However for dyer its misfires.
As you see from the image. Dryer at some point stops heating the drum and just spins it from time to time for an hour. During this period status periodically changes from ongoing to complete to idle to ongoing… and so on.
Is there a cure for this? Which parameter should I adjust to make job complete recognition more reliable?


more detailed image

Yes, there is a fix! The problem seems to be the same as @chicknlil25 (here), and the solution proposed (here) should work for you as well. However, you’ll likely have to set “Delayed Job Completion duration” (delayed_job_completion_duration) option to about 140 seconds.
Feel free to ask for help if this doesn’t solve your problem.

appreciate your quick response.
I will report after testing.

You are welcome! I’d like to use your graphs to document the problem. Do I have your permission?

I have no objections

1 Like

@leofabri I have just done one more washing cycle and noticed that there was not transition job_ongoing → job_complete it just went str8 to idle. Which didn’t trigger notification automation.

It looks like that part of the problem is now gone! :slightly_smiling_face:

I believe the automation is skipping the job_completed state because your power sensor is issuing power readings quite frequently, and the automation gets triggered immediately after the finishing power threshold is reached and the job is done. If my theory is correct, there’s a chance that the transition job_ongoing → job_completed will happen sometimes, but it’s completely unpredictable and it breaks the execution of the custom action you are trying to use.

I’ve addressed this issue in V3, but sadly, it has not been released yet. The next version will include some more timers, one of which will allow you to say for how long you want the job_completed state to persist before allowing the state machine to enter idle.

Here are your options:

  1. A little hack: Slow down the polling rate of your smart socket. Look for an option that allows you to receive new power reads slower, and if you find one, set it to 60 seconds. Note that not all sockets allow you to set the polling interval.

  1. Easier, temporary, but less elegant fix: Create an additional automation that detects when there’s a transition from job_completed → idle.

    Make a new automation. Copy and paste the following while in Edit YAML mode:

    alias: "Washing Machine - Job Completed detection - Temporary Fix"
    description: "This is a temporary fix. V3.0.0 will solve the issue."
    mode: single
    trigger:
      - platform: state
        entity_id:
          - input_select.washing_machine_state_machine
        from: job_ongoing
        to: idle
        id: job_done_trigger
    condition:
      - condition: trigger
        id: job_done_trigger
    action: 
        # Put your custom actions here
    

    Add your actions, as you would in your custom action section in the main automation.


  1. If you feel adventurous and you think you can make it, you could update straight to V3.0.0-dev.

    a. Replace the existing blueprint with V3-dev by issuing this command in your VSCode terminal:

    cd /config/blueprints/automation/leofabri && curl -sSL https://raw.githubusercontent.com/leofabri/hassio_appliance-status-monitor/release/v3.0.0-dev/appliance-status-monitor.yaml -O
    

    b. Now we need to create the helpers (yes, there are a few more compared to V2.1.1).
    First, find your washing machine package (should be inside of /config/packages) and delete it.
    Now, open the terminal in your VSCode and execute the following command

    mkdir -p /config/packages/appliances/washing_machine && cd /config/packages/appliances/washing_machine  && curl -sSL https://raw.githubusercontent.com/leofabri/hassio_appliance-status-monitor/release/v3.0.0-dev/home%20assistant/packages/washing_machine/asm_washing_machine.yaml -O
    
    

    You should see that a new package is created inside the washing_machine folder.

    c. Verify/Reboot Home Assistant

    d. Open your existing Washing Machine Automation → Edit in YAML → Copy and save the content you see on your PC because we are going to replace it entirely.

    e. Replace its content with https://raw.githubusercontent.com/leofabri/hassio_appliance-status-monitor/release/v3.0.0-dev/home%20assistant/pre_configurations/ui/asm_washing_machine_ui_starter.yaml

    f. Remember to set the following values appliance_socket, appliance_power_sensor, appliance_starting_power_threshold, appliance_finishing_power_threshold. You can also use the visual mode to do this. The values of these variables should match the ones of the old yaml you saved in step d.

    g. Save and perform step c. once more.

    h. From now on, if you need to configure more appliances, please refer to the new V3 guide here.

I’ll do my best to release V3 as soon as possible.

1 Like

hello, friend! I have my laundry running right now as I type this. Mostly succes thus far. It did alert once, relatively early in the process (and oops, just for a second time as I’m typing this!) but that had been it so far. Should I stretch out the 10 seconds to longer for next week? 12 or 15 seconds?

I think we’re muuuuuch closer to complete success though, which I’m extremely grateful for!

Any chance we can change the power consumption input to accept both watts and amps? the reason i ask is because the amp readings, at least on my setup seem to be significantly more steady than the watt readings:

Hey @leofabri - it went off 9 times in total. I’ve yet to be able to figure out a good way to get a solid, zoomed in view of a “short” history (a la a washing machine’s run time), so I’m not sure about how long that delay should be. This was definitely much better than previous runs though!

Hi @chicknlil25, you can definitely try with bigger values! The only thing to keep an eye on is that, if you set a considerable amount of time, the side-effect is that the automation becomes slower to detect when the appliance has finished its job. You ideally want the automation to be as accurate as possible.

If it’s not solved yet, but it at least improved a bit, then you definitely have to make it bigger. You can also experiment with 20 seconds, which seems to be a very acceptable amount of time still.

This looks very odd, almost as if your washing machine current consumption was a mean value and not an instant one. Are you by any chance calculating that current manually inside Home Assistant?

I’m saying this because the formula to calculate the power consumption is:
Power(W) = Voltage(V) * Current (I)
So, if your power consumption is that ‘bouncy’, it has to be someone else’s fault, either V’s or I’s (but I doubt that your voltage drops like that, it has to be the current).

You could try to do is to calculate another power consumption, but honestly, I wouldn’t worry about steadiness. It doesn’t look too bad. Try the automation, you can likely still use the integrated tricks to get it to work correctly :wink:

I would:

  • set the “Finishing power threshold” to the lowest power consumption you get during idle (say 8:52 of your graph);

  • set the “Starting power threshold” to a value that is slightly lower that the first peak of power you see when the appliance starts working (e.g. you see 3.7W, you set ~3.5W):

1 Like

I am not calculating these, they are direct readings from a Zooz zen15 power switch. It may be that it is sampling too often. here are all the readings it provides during that time period.

I will try the recommendations and let you know. Thank you for the great blueprint and also for being so willing to help!

I’ve set it for 13 for Saturday’s run. I know that’s Christmas Eve (should you celebrate it!) so I will perfectly understand if it takes SEVERAL days to respond, but I will keep you updated on how that adjustment goes (if 13 was enough or if I need to boost it more).

Happy Holidays, and thanks again for your help.

so, i contacted the Zooz peeps and they sent me a firmware update for the switch. here are the results after updating the switch…

seems that it was all over the map on the old firmware. this should make it easier to fine tune!

1 Like

Yes, it should make things a bit easier! And the instructions are still valid :smiley:

Happy Holidays and Merry Christmas to you and everybody on this forum! :christmas_tree: :stars:
Replying to these topics is also helping me to decide how I want the documentation for V3 to look, that’s a win-win for everybody.
You are being very conservative on that value, but experimenting it’s never wrong.

Well I’ve certainly got time between now and Saturday to bump that up. Do you think I should just go straight to 20 and see if that does the trick?

Glad to know we can help you, at least a little bit, for all the help you’ve provided all of us!

The purpose of having a small value is to do things in real-time.
There’s another piece of automation I’m working on that connects to this one. It will more or less tell you stats like these:

I made this according to the request of @_Xander:

This feature does require precision because you’ll eventually want to know if your appliance has finished its cycle, and the detection has to be close to reality.

Having a value of less than 1 min is already a big accomplishment because it doesn’t affect precision in a meaningful way. Setting it to 20 is more than reasonable.

5 Likes