template: - binary_sensor: - name: Dishwasher unique_id: templatebinarysensor.dishwasher icon: mdi:dishwasher delay_on: "{{states('input_number.dishwasher_delay_on') | float(default=0) }}" delay_off: "{{states('input_number.dishwasher_delay_off') | float(default=0) }}" availability: "{{ states('sensor.pm_dishwasher_w') not in ['unkown', 'unavailable'] }}" attributes: model_number: 'MDB6769PAS1' serial_number: 'F24407234' power: "{{ states('sensor.pm_dishwasher_w') | float(default=0)}}" target: "{{ states('input_number.dishwasher_on') | float(default=0)}}" state: "{{ states('sensor.pm_dishwasher_w')|float(default=0) >= states('input_number.dishwasher_on')|float(default=0) }}" - sensor: - name: Dishwasher unique_id: templatesensor_dishwasher state: > {% if is_state('binary_sensor.dishwasher','on')%} running {% elif is_state('binary_sensor.dishwasher','off') and is_state('input_boolean.empty_dishwasher','on') %} pending {% else %} idle {% endif %} icon: > {% if is_state('sensor.dishwasher','idle') %} mdi:dishwasher-off {% elif is_state('sensor.dishwasher','pending') %} mdi:dishwasher-alert {% else %} mdi:dishwasher {% endif %} attributes: model_number: 'MDB6769PAS1' serial_number: 'F24407234' power: "{{ states('sensor.pm_dishwasher_w') | float(default=0)}}" target: "{{ states('input_number.dishwasher_on') | float(default=0)}}" input_boolean: empty_dishwasher: name: Empty Dishwasher icon: mdi:cupboard input_number: dishwasher_on: # was 4 name: 'Dishwasher On' icon: mdi:dishwasher min: 0 max: 1000 step: 0.1 mode: box unit_of_measurement: W dishwasher_off: name: 'Dishwasher Off' icon: mdi:dishwasher-off min: 0 max: 1000 step: 0.1 mode: box unit_of_measurement: W dishwasher_delay_on: name: 'Dishwasher Delay On' icon: mdi:clock min: 0 max: 900 step: 10 mode: box dishwasher_delay_off: # was 600 name: 'Dishwasher Delay Off' icon: mdi:clock-alert min: 0 max: 900 step: 10 mode: box automation: - id: automation_empty_dishwasher_state alias: Empty Dishwasher trigger: - id: dishwasher_off platform: state entity_id: binary_sensor.dishwasher from: 'on' to: 'off' - id: dishwasher_on platform: state entity_id: binary_sensor.dishwasher from: 'off' to: 'on' - id: door_open platform: state entity_id: binary_sensor.dishwasher_door_contact from: 'off' to: 'on' for: seconds: 5 condition: [] action: - choose: - alias: "Dishwasher is running. No need to empty it yet" conditions: - condition: trigger id: dishwasher_on - condition: state entity_id: input_boolean.empty_dishwasher state: 'on' sequence: - service: logbook.log data_template: name: Empty Dishwasher - Load Started entity_id: automation.empty_dishwasher message: Dishwasher just turned on. Turning off input_boolean in case it got left on - service: homeassistant.turn_off target: entity_id: input_boolean.empty_dishwasher - alias: "Dishwasher finished while door was shut" conditions: - condition: trigger id: dishwasher_off - condition: state entity_id: binary_sensor.dishwasher_door_contact state: 'off' sequence: - service: logbook.log data_template: name: Empty Dishwasher - Load finished entity_id: automation.empty_dishwasher message: Dishwasher just turned off while the door was shut. Assuming dishes need to be put away - service: homeassistant.turn_on target: entity_id: input_boolean.empty_dishwasher - alias: "Door was opened for 30 seconds while dishwasher was off" conditions: - condition: trigger id: door_open - condition: state entity_id: binary_sensor.dishwasher state: 'off' sequence: - service: logbook.log data_template: name: Empty Dishwasher - Dishes put away entity_id: automation.empty_dishwasher message: Dishwasher door was opened while the dishwasher was off. Assuming dishes don't need to be put away. - service: homeassistant.turn_off target: entity_id: input_boolean.empty_dishwasher mode: single