====== Washing Machine Notifications ======
Our washing machine is connected to a "smart plug" which is capable of reporting the current draw. This is used for detecting when the machine is running. However, the plug is not able to sense the very low current draw the machine has when it is idle (ie finished a cycle).
In addition to the smart plug, the door of the machine is fitted with an RF door sensor. This senor generated a code via 433MHz (similar to our light buttons) to indicate that the door has opened.
Combining these two inputs together it is possible to infer when the machine has finished and needs to be emptied.
===== Machine Running Sensor =====
This binary sensor is a basic template, using the current draw detected by the smart plug;
template
...
- binary_sensor:
- name: 'Washing Machine Running'
unique_id: binary_sensor.washing_machine_running
state: >
{{ states('sensor.washing_machine_current')|float(0) > 120 }}
delay_off:
minutes: 5
icon: mdi:washing-machine
The delay_off of 5 minutes is included to avoid incorrectly detecting the machine as off in the middle of a cycle. Unfortunately this means that there is a delay of 5 minutes in the sensor switching to off once the machine has finally finished.
This leads to a race condition, where the machine could be emptied by a particularly enthusiastic household member before the 5 minutes has expired, only to be needlessly told that the machine should be emptied.
To avoid this the empty/full state of the machine is inferred, using a combination of the door sensor and the machine running state.
template:
...
- trigger:
- platform: event
event_type: esphome.rf_code_received
event_data:
code: '44556'
id: "off"
- platform: state
entity_id:
- binary_sensor.washing_machine_running
from: "off"
to: "on"
id: "on"
binary_sensor:
- name: 'Washing Machine Full'
unique_id: binary_sensor.washing_machine_full
state: "{{ trigger.id }}"
If the machine is running then it must be full, so a change from "off" to "on" will change this sensor to full (on). At the other end of the cycle, we assume that if the door has been opened (detected through the RF code being received) then it has been emptied.
These two inputs are combined in a single automation which can announce that the machine needs to be emptied when necessary, yet avoid doing so if someone has gotten to it first;
- id: '1636737445833'
alias: Notification:Washing Machine:Sensor
description: Send a notification when the washing machine is finished
trigger:
- platform: state
entity_id:
- binary_sensor.washing_machine_running
for:
hours: 0
minutes: 0
seconds: 0
id: ' Washing Machine'
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: input_boolean.active
state: 'on'
- condition: state
entity_id: binary_sensor.washing_machine_full
state: 'on'
action:
- service: tts.google_translate_say
data:
cache: true
entity_id: media_player.kitchen_and_dining_room
message: The washing machine has finished.
- if:
- condition: state
entity_id: person.adrian
state: home
then:
- service: notify.mobile_app_adrian_s_pixel_6a
data:
message: The washing machine has finished.
title: The washing machine has finished.
- if:
- condition: state
entity_id: person.nancy
state: home
then:
- service: notify.mobile_app_nancys_phone
data:
title: The washing machine has finished.
target: The washing machine has finished.