Skip to content

Instantly share code, notes, and snippets.

@pantherale0
Last active March 31, 2025 22:16
Show Gist options
  • Save pantherale0/f109278274f1cbfe2bbee4e1451b7a30 to your computer and use it in GitHub Desktop.
Save pantherale0/f109278274f1cbfe2bbee4e1451b7a30 to your computer and use it in GitHub Desktop.
HA Automatic Dishwasher Controller
blueprint:
name: Automatic Dishwasher Controller
description: Make your dishwasher smart using just a smartplug and some helpers!
domain: automation
input:
template_dishwasher_state_sensor:
name: (Helper) State Sensor
description: The helper you created that stores the dishwasher state
selector:
entity:
domain: sensor
input_bool_scheduled:
name: (Helper) Scheduled Boolean
description: The input boolean that stores the dishwasher scheduled state.
selector:
entity:
domain: input_boolean
input_bool_running:
name: (Helper) Running Boolean
description: The input boolean that stores if the dishwasher is currently running or not
selector:
entity:
domain: input_boolean
schedule_target:
name: Binary Sensor Target Reached
description: The sensor to use that defines when the dishwasher plug should turn back on again
selector:
entity:
domain: binary_sensor
dishwasher_switch:
name: Dishwasher Switch
description: The switch that is used to turn the dishwasher on and off
selector:
entity:
domain: switch
source_url: https://gist.github.com/pantherale0/f109278274f1cbfe2bbee4e1451b7a30
mode: restart
max_exceeded: silent
triggers:
- trigger: state
entity_id: !input "template_dishwasher_state_sensor"
id: complete
to: COMPLETE
for:
hours: 0
minutes: 5
seconds: 0
- trigger: state
entity_id: !input "schedule_target"
id: target
- trigger: state
entity_id: !input "template_dishwasher_state_sensor"
id: state
conditions: []
actions:
- variables:
power_control_entity: !input "dishwasher_switch"
state_entity: !input "template_dishwasher_state_sensor"
- alias: Main Control Function
choose:
- conditions:
- condition: trigger
id:
- state
sequence:
- alias: State Controller
choose:
- conditions:
- condition: template
value_template: "{{ trigger.to_state.state == 'OFF' }}"
sequence: []
alias: "OFF"
- conditions:
- condition: template
value_template: "{{ trigger.to_state.state == 'PROGRAMMING' }}"
sequence: []
alias: PROGRAMMING
- conditions:
- condition: template
value_template: "{{ trigger.to_state.state == 'PENDING' }}"
- condition: state
entity_id: !input "input_bool_running"
state: "off"
- condition: state
entity_id: !input "input_bool_scheduled"
state: "off"
sequence:
- action: switch.turn_off
metadata: {}
data: {}
target:
entity_id: !input "dishwasher_switch"
- action: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: !input "input_bool_scheduled"
alias: PENDING
- conditions:
- condition: template
value_template: "{{ trigger.to_state.state == 'SCHEDULED' }}"
sequence: []
alias: SCHEDULED
- conditions:
- condition: template
value_template: "{{ trigger.to_state.state == 'RUNNING' }}"
sequence: []
alias: RUNNING
alias: Triggered By State
- conditions:
- condition: trigger
id:
- target
sequence:
- if:
- condition: state
entity_id: !input "input_bool_scheduled"
state: "on"
- condition: template
value_template: "{{ trigger.to_state.state == 'on' }}"
alias: Target Sensor On
then:
- action: homeassistant.turn_on
metadata: {}
data: {}
target:
entity_id:
- !input "dishwasher_switch"
- !input "input_bool_running"
alias: Triggered by Target
- conditions:
- condition: trigger
id:
- complete
sequence:
- action: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id:
- !input "input_bool_scheduled"
- !input "input_bool_running"
alias: Triggered by Complete
{% set programming_min = 1 %}
{% set programming_max = 10 %}
{% set power_off_min = 0 %}
{% set power_off_max = 1 %}
{% set complete_max = 2 %}
{% set cycle_started_min = 5 %}
{% set power = states('sensor.dishwasher_current_consumption')|float(0) %}
{% set power_state = states('switch.dishwasher') %}
{% set scheduled = 'input_boolean.dishwasher_scheduled' %}
{% set scheduled_running = 'input_boolean.dishwasher_running_from_schedule' %}
## REMOVE ONLY THIS LINE, CHANGE ABOVE OPTIONS BASED ON MEASUREMENTS FOR YOUR DISHWASHER AND SETUP
{% if power > programming_min and power < programming_max and states(scheduled) == 'off' and states(scheduled_running) == 'off' %}
PROGRAMMING
{% elif power_state == 'off' and states(scheduled) == 'on' and states(scheduled_running) == 'off' %}
SCHEDULED
{% elif power_state == 'on' and states(scheduled) == 'off' and power > power_off_min and power < power_off_max and states(scheduled_running) == 'off' %}
OFF
{% elif states(scheduled) == 'off' and states(scheduled_running) == 'off' and power >= cycle_started_min %}
PENDING
{% elif states(scheduled_running) == 'on' and power > complete_max and states(scheduled) == 'on' %}
RUNNING
{% elif power_state == 'on' and states(scheduled) == 'on' and power < complete_max and states(scheduled_running) == 'on' %}
COMPLETE
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment