Detect Drying Cycle of Dishwasher

Screenshot 2021-08-24 094634

This is the power usage of my dishwasher with the drying cycle turned on.
The spikes starting above 10pm, is the drying cycle.
When drying, the wattage spikes to around 630, for about a minute, then drop to 1.7 for about another minute, then spikes to 630 for about another minute, and so on, and so forth.
How can I detect this sequence to update the status from “washing”, to “drying”?
My initial thought is to just base it on time; just say “ok, after 40 minutes, it must be drying”.
Problem with that is, what if the drying cycle is turned off?
I guess I could say, "ok, after 40 minutes, if there is power usage it must be drying, otherwise, set to “clean”?

Here’s my current code to set state to washing:

- id: '1629775434888'
  alias: Dishwasher - Set dishwasher active when power detected
  description: ''
  - platform: numeric_state
    entity_id: sensor.shelly1pm_84cca8af1140_power
    above: '2'
    for: 00:00:05
  - condition: or
    - condition: state
      entity_id: sensor.dishwasher_status
      state: Idle
    - condition: state
      entity_id: sensor.dishwasher_status
      state: Clean
  - service: input_select.select_option
      option: Washing
      - input_select.dishwasher_status

and my current code to set status to clean:

- id: '1629775577060'
  alias: Dishwasher - Set dishwasher to clean
  description: ''
  - platform: numeric_state
    entity_id: sensor.shelly1pm_84cca8af1140_power
    above: '1.5'
    below: '1.8'
    for: 00:02:00
  - condition: and
    - condition: state
      entity_id: input_select.dishwasher_status
      state: Washing
    - condition: template
      value_template: "{% if states.automation.dishwasher_set_dishwasher_active_when_power_detected.last_triggered\
        \ is not none %}\n            {% if as_timestamp(now()) | int   -  as_timestamp(states.automation.dishwasher_set_dishwasher_active_when_power_detected.last_triggered)\
        \ | int > 2700 %} true {% else %} false\n            {% endif %}\n       \
        \   {% else %}\n          false\n          {% endif %}"
  - service: input_select.select_option
      option: Clean
      - input_select.dishwasher_status

Does anyone have any ideas how to cleanly detect the drying cycle?


If you’re interested, I explained how I interpret a washing machine’s current operating phase (11 distinct phases) based on:

  1. Its power consumption.
  2. Its previous operating phase.

The following post provides an overview and contains another link showing the related automation.

Based on power consumption alone, it can only detect the following phases (reported by a Template Sensor using power measurements from a smart plug):

- stop (no power consumed)
- fill (filling water for either washing or rinsing)
- run (agitation for either washing or rinsing phase)
- pulse (representing the power spike when the spin cycle begins after washing or rinsing)
- wait (short waiting period before the rinse cycle begins)

However, an automation uses that information to step through an input_select containing 11 washing phases:

      - 'stop'
      - 'wash fill'
      - 'wash'
      - 'wash spin'
      - 'wash drain'
      - 'rinse fill'
      - 'rinse wait'
      - 'rinse'
      - 'rinse spin'
      - 'rinse drain'
      - 'unknown'

In your case, you can characterize the drying phase as power consumption between 610 and 650 watts. Any dip in power of less than 60 seconds duration is ignored (which effectively ignores the ‘troughs’ between each drying ‘peak’). The drying phase is considered finished when power consumption is below, say, 2 watts for more than 60 seconds.

Put a statistics sensor on the wattage.
Have it set to take values over a time of two minutes and if the average value (in the attributes of statistics sensor) is around 630 watts then you are in drying cycle.

@123, your idea is interesting. I currently have a washing machine monitor setup, but, it just reports “Idle”, “Washing”, and “Clean”. I think I would have to study each possible combination of cycles in order to get all the right readings; to implement your more precise method; but, that’s for a different thread. However, a dishwasher is more simple. Wouldn’t I still have to utilize @Hellis81 's method in order to eliminate the valley’s?

No but go ahead and try it because it may be the most straightforward way to meet your requirements.

I just want to make sure I’m not missing something stupid here. I don’t see an average value in the attributes. Here is my code for the sensor.

- platform: statistics
  entity_id: sensor.shelly1pm_84cca8af1140_power
  name: dishwasher_power_statistics
    minutes: 2

I would assume the mean however would accomplish the same goal?

mean = average. Or state
But obviously it will not show 630 now that I think about it. It should be about half since it’s “off” half the time.

Sweet! That’s what I assumed; just wanted to clarify. Thank-you.