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
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:
Define a input_boolean called washer_running thatās set to on or off
Set washer_running to on if itās currently off and wattage is more than 1 for one minute
Set washer_running to off if itās currently on and wattage is below 1 for two minutes
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
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
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
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.
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.
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.