Github Gist: https://gist.github.com/sbyx/6d8344d3575c9865657ac51915684696
Explanation
This one is pretty simple. It triggers a set of user defined actions when some appliance like a dishwasher or washing machine has finished after running. It uses a power sensor to detect finishing. First we check that the thing has been started, i.e. crossing a certain power threshold for a given time. This is necessary so the action is not triggered at startup or after reloading automations. Then we detect that the appliance has finished by waiting until it crosses below a certain power level for some time. The actions to perform e.g. push notification or TTS announcement via Google Home can be freely chosen.
Blueprint Code
Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)
Or import this Blueprint by using the forum topic / Gist URL:
blueprint:
name: Appliance has finished
description: Do something when an appliance (like a washing machine or dishwasher)
has finished as detected by a power sensor.
domain: automation
input:
power_sensor:
name: Power Sensor
description: 'Power sensor entity (e.g. from a smart plug device).'
selector:
entity:
domain: sensor
starting_threshold:
name: Starting power threshold
description: Power threshold above which we assume the appliance has started.
default: 5
selector:
number:
min: 1.0
max: 100.0
unit_of_measurement: W
mode: slider
step: 1.0
starting_hysteresis:
name: Starting hysteresis
description: Time duration the power measurement has to stay above the starting
power threshold.
default: 5
selector:
number:
min: 0.25
max: 60.0
unit_of_measurement: min
mode: slider
step: 0.25
finishing_threshold:
name: Finishing power threshold
description: Power threshold below which we assume the appliance has finished.
default: 5
selector:
number:
min: 1.0
max: 100.0
unit_of_measurement: W
mode: slider
step: 1.0
finishing_hysteresis:
name: Finishing hysteresis
description: Time duration the power measurement has to stay below the finishing
power threshold.
default: 5
selector:
number:
min: 0.25
max: 60.0
unit_of_measurement: min
mode: slider
step: 0.25
actions:
name: Actions
description: Actions (e.g. pushing a notification, TTS announcement, ...)
selector:
action: {}
source_url: https://gist.github.com/sbyx/6d8344d3575c9865657ac51915684696
trigger:
- platform: numeric_state
entity_id: !input 'power_sensor'
for:
minutes: !input 'starting_hysteresis'
above: !input 'starting_threshold'
condition: []
action:
- wait_for_trigger:
- platform: numeric_state
entity_id: !input 'power_sensor'
below: !input 'finishing_threshold'
for:
minutes: !input 'finishing_hysteresis'
- choose: []
default: !input 'actions'
mode: single
max_exceeded: silent
Changelog
- 2020-12-30: Increase hysteresis resolution to 1/4 minutes
- 2020-12-27: Relax selector since HA has very inconsistent device_classes.
- 2020-12-13: Initial version