No notification after washer or dryer completes

Hello,

I am currently working on setting up notifications for when the washer cycle is complete or the dryer cycle is complete.

The washer is based on wattage usage and the dryer is based on a temperature sensor near the air exhaust. 0-20 minute delays arent a big deal but ideally the shorter the better.

Here is my washer yaml.

alias: Power Washer-OFF
description: 'When the watts on the washer is high enough and then reaches 0, send notis'
trigger:
  - type: power
    platform: device
    device_id: abf43f0811ca11eb80527bda4ddf9b35
    entity_id: sensor.zen15_power_switch_electric_w
    domain: sensor
    above: 2
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition: []
action:
  - delay: '00:05:00'
  - condition: state
    entity_id: sensor.zen15_power_switch_electric_w
    state: '0'
    attribute: unit_of_measurement
  - service: notify.hagroupnotifyphones
    data:
      message: Dryer cycle complete
mode: restart
max: 10

I get no errors as far as syntax goes, when testing and hitting execute, I do indeed get a notification. So it appears I can’t figure out logic.

Here is my YAML for my dryer.

alias: Temp Dryer-OFF
description: 'When the temperature on the dryer is low enough, time to notify. '
trigger:
  - type: temperature
    platform: device
    device_id: 9c6da5e1f97f4807b7ff18a69a9b87f0
    entity_id: sensor.aqara_temp1_e1b67b04_temperature
    domain: sensor
    above: 70
    for:
      hours: 0
      minutes: 1
      seconds: 0
condition:
  - type: is_temperature
    condition: device
    device_id: 9c6da5e1f97f4807b7ff18a69a9b87f0
    entity_id: sensor.aqara_temp1_e1b67b04_temperature
    domain: sensor
    below: 60
action:
  - service: notify.hagroupnotifyphones
    data:
      message: Dryer cycle complete
mode: queued
max: 10

Notifications were sent successfully when hitting the execute button when creating it but it appears I do not get notifications in real world usage for washer or dryer.

If I’m reading it correctly, your washer yaml says “if wattage is above 2 for 5 minutes, then wait for 5 minutes, then check wattage state’s attribute called unit_of_measurement and stop if it doesnt match string ‘0’, then notify with message ‘Dryer cycle complete’” ? Is that the logic that you intend to have?

Off the top of my head, things that might be causing problems here:

  • state of sensor.zen15_power_switch_electric_w's attribute unit_of_measurement being compared to '0' - do you need that attribute? does that sensor report wattage in floats (0.0) or ints (0)? You might want to try changing that to numeric_state and get rid of the attribute line, as described here: https://www.home-assistant.io/docs/scripts/conditions/#numeric-state-condition something like
- condition: numeric_state
  entity_id: sensor.zen15_power_switch_electric_w
  below: 0.1
  • are you sure on what would happen if your cycle runs for longer than 10 minutes? will the trigger get fired again? and wouldn’t mode: restart cause this automation to get constantly restarted by new triggers once the wattage stays above 2 for longer than 5 minutes? I’m not entirely sure how HA would handle that, but it seems a little sketchy?

I happen to have the same kind of automation, except that I do it in four parts:

  1. Define a input_boolean called washer_running that’s set to on or off
  2. Set washer_running to on if it’s currently off and wattage is more than 1 for one minute
  3. Set washer_running to off if it’s currently on and wattage is below 1 for two minutes
  4. Whenever washer_running changes state from on to off, send notification

This logic seems to work reliably (never had a misfire in the past few months), and I have essentially a binary sensor called washer_running that reflects the current state of the washer without having to look at wattage. Yaml is definitely longer than what you are trying to do, but i don’t mind - i did it all thru UI anyway.

Here’s my yaml:

part 1 is a Helper called input_boolean.washer_running defined under Helpers - not sure what the yaml looks like…

automation 2

alias: Detect washer started
description: Use power consumption data to detect when washer started running
trigger:
  - platform: numeric_state
    entity_id: sensor.basement_washer_plug_electric_w
    above: '1'
    for: '0:01'
condition:
  - condition: state
    entity_id: input_boolean.washer_running
    state: 'off'
action:
  - service: input_boolean.turn_on
    data: {}
    entity_id: input_boolean.washer_running
mode: single

automation 3

alias: Detect washer stopped
description: ''
trigger:
  - platform: numeric_state
    entity_id: sensor.basement_washer_plug_electric_w
    below: '1'
    for: '0:02'
condition:
  - condition: state
    entity_id: input_boolean.washer_running
    state: 'on'
action:
  - service: input_boolean.turn_off
    data: {}
    entity_id: input_boolean.washer_running
mode: single

automation 4

alias: Notify when washer stops
description: ''
trigger:
  - platform: state
    entity_id: input_boolean.washer_running
    from: 'on'
    to: 'off'
condition: []
action:
  - service: notify.mobile_app_iphone
    data:
      message: 'Laundry is washed, time to dry!'
mode: single

hope this helps with the washer part?

2 Likes

First off, thank you.

Thank you for taking the time to post an incredibly helpful and detailed post. I have gone ahead and created a helper for the first time ever. Afterward created two automations, as you have made, to either turn it off or on. Lastly, a final automation to send a notification. I’ve restarted home assistant and have a load in the washer.

I am super eager because I really think this will work out. Thank you!!!

I’ll see if I can replicate this success with the dryer. I think creating a helper will be part of my solution with the dryer as well. Dryer is electric but I don’t have a smart wall plug/switch that can handle 30 amps.

Did you stop your notifications with just mobile? Was thinking about voice alerts from Alexa.

The problem with your original automation is the condition in the action:

- condition: state
    entity_id: sensor.zen15_power_switch_electric_w
    state: '0'
    attribute: unit_of_measurement

You need to remove the last line, currently it checks whether the attribute unit_of_measurement is equal to 0, however this attribute is just a string, like ‘w’ or ‘%’, not the actual value of the sensor.

You are welcome. After I posted the automations yaml last night, I actually did add an audio message to play over the kitchen speakers. WAF is high on that one :slight_smile:

As for the dryer, I’m in the same boat, but I’m going with a sound level sensor and ESPHome instead of a temperature sensor. Still working on a 3d printed enclosure for the sensor.

Let us know how the automation works out!

Here’s a simple automation to report when the laundry is done.

alias: 'Laundry monitor'
trigger:
- platform: numeric_state
  entity_id: sensor.zen15_power_switch_electric_w
  above: 2
  for: '00:01:00'
action:
- wait_for_trigger:
  - platform: state
    entity_id: sensor.zen15_power_switch_electric_w
    to: '0'
    for: '00:00:05'
- service: notify.hagroupnotifyphones
  data:
    message: 'Laundry is done.'

It is triggered by a Numeric State Trigger when the sensor reports a value greater than 2 for at least 1 minute.

After being triggered, the action contains a wait_for_trigger that waits until a State Trigger detects the sensor’s value is 0 for at least 5 seconds. Then it sends a notification.

1 Like

Nice and short, thanks. Ideally i’d like to have a separate “washer running” binary sensor that i can display on a card that’s more accurate than a template sensor on top of power consumption reading (because mine jumps to/from 0 watts during wash cycle). By more “accurate” I mean in sync with the notification - @123 can you suggest anything more elegant than having input_boolean.turn_on/off inside the automation you posted? This is already an improvement on 3 separate automations I have, but I still might stick with having a separate boolean input helper for status.

To be clear, what I posted was meant to show the bare minimum for detecting and reporting the end of a washing cycle. As we both know from experience, detecting the true end of the wash cycle is often more complicated than simply the moment it reports zero watts. In addition, we may want to know more about how far along the machine is in its operation (i.e. you are currently using an input_boolean).

I posted a detailed version of my configuration elsewhere in response to someone else’s request for monitoring a washing machine. It’s located here: Washer Monitor. However, here’s a brief overview of the challenge I faced and what I concocted to address it.

For my trusty old washing machine, the reported power consumed by its wash and rinse cycles is nearly the same. In other words, if it reports a value of “380 W” that information alone isn’t enough to determine if it’s currently washing or rinsing. All I can conclude is that it is “running”. However, it’s enough to tell me it isn’t “filling” with water (uses far less power) or in the “spinning” phase (uses far more power).

The one saving grace is that when it reports “0 W” it is truly off. However, that’s insufficient to conclude it just finished a washing cycle. It may have just finished a prewash cycle and now the tub is filled with clothes soaking in wash water and the machine is consuming no power (and waiting for someone to turn the knob from ‘prewash’ to ‘wash’ mode). The only way to determine if it just finished a wash cycle is to know the previous phase. Something is needed to track the machine’s phases (spoiler: it’s an Input Select).

The solution I’m using contains three things:

  • Template Sensor to report simple operating phases inferred directly from power consumption: stop, fill, run, pulse, wait.
  • Input Select containing options representing the machine’s true operating phases: wash fill, wash, wash spin, wash drain, rinse fill, rinse wait, rinse, rinse drain, stop, and ‘unknown’ (for when things go awry).
  • Automation triggered by the Template Sensor which sets the Input Select’s option to indicate the machine’s true, current operating phase.

The Input Select serves to track the machine’s operating phases. For example, if the Template Sensor reports “run” and the Input Select is currently set to ‘wash fill’ that means the machine just finished the ‘wash fill’ phase and is now in the ‘wash’ phase. Therefore the automation sets the Input Select to the ‘wash’ option.

  • When the Template Sensor reports ‘pulse’, the Input Select is set to the next phase: ‘wash spin’.
  • When the sensor reports “run” again, because the previous phase was ‘rinse spin’ it’s now set to ‘rinse drain’.
  • And so on and so on until the previous phase was ‘rinse drain’ and the Template Sensor now reports ‘stop’. That’s a clear indication that all wash phases have completed and the machine is truly finished washing a load of laundry.
1 Like

Haha, that’s hardcore! Thanks for the link. I gotta try the input select trick to represent a state machine at some point.