Skip to content

Instantly share code, notes, and snippets.

@lociii
Created November 9, 2025 12:14
Show Gist options
  • Select an option

  • Save lociii/797c0b6d429b7dae3f435231518d7aa3 to your computer and use it in GitHub Desktop.

Select an option

Save lociii/797c0b6d429b7dae3f435231518d7aa3 to your computer and use it in GitHub Desktop.
An appliance status blueprint that survives HomeAssistant reboots
# roughly based on https://gist.github.com/sbyx/6d8344d3575c9865657ac51915684696
mode: single
max_exceeded: silent
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:
multiple: false
filter:
domain: sensor
device_class:
- power
appliance_status_helper:
name: Appliance status boolean helper
description: A boolean helper that remembers when the appliance has started
selector:
entity:
multiple: false
filter:
domain: input_boolean
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: 1000.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: 1.0
max: 60.0
unit_of_measurement: min
mode: slider
step: 1.0
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: 1000.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: 1.0
max: 60.0
unit_of_measurement: min
mode: slider
step: 1.0
start_actions:
name: Start actions
description: Actions when starting threshhold is crossed
default: []
selector:
action: {}
finish_actions:
name: Finish actions
description: Actions when finishing threshold is crossed
default: []
selector:
action: {}
source_url: https://gist.github.com/sbyx/6d8344d3575c9865657ac51915684696
# when to execute
trigger:
- trigger: numeric_state
entity_id: !input power_sensor
above: !input starting_threshold
for:
minutes: !input starting_hysteresis
id: started
- trigger: numeric_state
entity_id: !input power_sensor
below: !input finishing_threshold
for:
minutes: !input finishing_hysteresis
id: finished
# generic execution conditions
condition: []
variables:
appliance_status_helper: !input appliance_status_helper
# what to do
action:
# starting threshold passed and appliance is not yet marked on
- choose:
- conditions:
- condition: template
alias: "Starting threshold passed"
value_template: "{{ trigger.id == 'started' }}"
- condition: template
alias: "Appliance not yet active"
value_template: "{{ is_state(appliance_status_helper, 'off') }}"
sequence:
- action: input_boolean.turn_on
alias: "Mark appliance on"
target:
entity_id: "{{ appliance_status_helper }}"
- choose: []
default: !input start_actions
# finishing threshold passed and appliance is not yet marked off
- choose:
- conditions:
- condition: template
alias: "Finishing threshold passed"
value_template: "{{ trigger.id == 'finished' }}"
- condition: template
alias: "Appliance not yet active"
value_template: "{{ is_state(appliance_status_helper, 'on') }}"
sequence:
- action: input_boolean.turn_off
alias: "Mark appliance off"
target:
entity_id: "{{ appliance_status_helper }}"
- choose: []
default: !input finish_actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment