Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sbyx/6d8344d3575c9865657ac51915684696 to your computer and use it in GitHub Desktop.
Save sbyx/6d8344d3575c9865657ac51915684696 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint: Notify or do something when an appliance like a dishwasher or washing machine finishes
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: {}
pre_actions:
name: Actions
description: Actions when starting threshhold is crossed
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:
- choose: []
default: !input 'pre_actions'
- 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
@HollyFredD
Copy link

Thanks for this very useful blueprint.
It used to work for me prior to delete and reinstall it.

Now the installation is working fine, but when I try to create an automation, I have the following error message 👍
"Message malformed: Missing input pre_actions"

Would you have any clue ?

not working for me, it says 'Message malformed: Missing input pre_actions'

A good solution has been shared on the Home Assistant community forum :
https://community.home-assistant.io/t/notify-or-do-something-when-an-appliance-like-a-dishwasher-or-washing-machine-finishes/254841/117?u=hollyfredd

@jcwhite116
Copy link

I am unable to create an automation using this blueprint. It says "Message malformed: Missing input pre_actions" I do not know what this means.

@kimbo1st
Copy link

kimbo1st commented Jan 9, 2023

I am unable to create an automation using this blueprint. It says "Message malformed: Missing input pre_actions" I do not know what this means.

Same here…

@jfi1310
Copy link

jfi1310 commented Jan 17, 2023

Added another threshold to detect if the Washing machine is turned Off (and thus empty) or still in standby. Here is my code:

off_threshold:
  name: Machine Off threshold
  description: Power threshold above which we assume the appliance is turned off.
  default: 1
  selector:
    number:
      min: 0.0
      max: 5.0
      unit_of_measurement: W
      mode: slider
      step: 0.1
off_hysteresis:
  name: Machine Off hysteresis
  description: Time duration the power measurement has to stay above the Machine Off threshold
    power threshold.
  default: 1
  selector:
    number:
      min: 0.25
      max: 60.0
      unit_of_measurement: min
      mode: slider
      step: 0.25

and another trigger and action:

trigger:
- platform: numeric_state
  entity_id: !input power_sensor
  for:
    minutes: !input starting_hysteresis
  above: !input starting_threshold
condition: []
action:
- choose: []
  default: !input pre_actions
- wait_for_trigger:
  - platform: numeric_state
    entity_id: !input power_sensor
    below: !input finishing_threshold
    for:
      minutes: !input finishing_hysteresis
- choose: []
  default: !input actions
- wait_for_trigger:
  - platform: numeric_state
    entity_id: !input power_sensor
    below: !input off_threshold
    for:
      minutes: !input off_hysteresis
- choose: []
  default: !input off_actions

@dersch81
Copy link

I am unable to create an automation using this blueprint. It says "Message malformed: Missing input pre_actions" I do not know what this means.

Same here

@Steeveeveeve
Copy link

Steeveeveeve commented Dec 13, 2023

For those getting, 'Message malformed: Missing input pre_actions', add a wait time of 1 second into, 'Actions when starting threshhold is crossed' section at the bottom and it'll be saveable.

Thank you to the author of this plugin - it is very useful.

PS, Threshold has been spelt incorrectly :)

@hf-krechan
Copy link

I was also struggling with the error message Message malformed: Missing input pre_actions.
You have to define a pre-action. If you do not need one, you can add just a 1s delay like @Steeveeveeve mentioned.
Here is my yaml file which you can copy and paste into the yaml editor.

alias: Waschmaschine ist fertig
description: ""
use_blueprint:
  path: >-
    sbyx/notify-or-do-something-when-an-appliance-like-a-dishwasher-or-washing-machine-finishes.yaml
  input:
    power_sensor: sensor.switch_bathroomfloor_plug_washingmashine_power
    starting_threshold: 100
    starting_hysteresis: 5
    finishing_threshold: 5
    finishing_hysteresis: 5
    actions:
      - service: notify.mobile_app_heliumhypernet
        metadata: {}
        data:
          message: Waschmaschine ist fertig
          title: I am done
    pre_actions:
      - delay:
          hours: 0
          minutes: 0
          seconds: 1
          milliseconds: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment