I had a problem with my dishwasher “powering down” and double triggering. Some sort of drying cycle I guess but it gave a false trigger of completing. I solved it by counting the power cycles using the variable component (a must have HA add-on IMHO).
Here is what I did:
Create the template sensor to represent the dish washer. On is based on trigger power level
- platform: template
sensors:
appliance_washon:
friendly_name: Appliance Dishwasher
value_template: >-
{% if is_state('switch.plug_158d00024ef7d1', 'off') %}
off
{% elif (states.switch.plug_158d00024ef7d1.attributes.load_power|float) < 10 %}
standby
{% elif is_state('switch.plug_158d00024ef7d1', 'on') %}
on
{% else %}
failed
{% endif %}
Added a variable to monitor false power downs
variable:
washing_offcount:
value: 0
Automation to alert when on. Note it will only alert if variable is 0. If 1 it is a “false start” and will be ignored
- id: '1537094498820'
alias: DishOn
trigger:
- entity_id: sensor.appliance_dishon
for:
minutes: 1
platform: state
to: 'on'
condition: []
action:
- below: '1'
condition: numeric_state
entity_id: variable.washing_offcount
- data_template:
message: dishwasher on {{ now() }}
service: persistent_notification.create
Automation for when finished. It will only trigger when variable is 2.
- id: '1537094852909'
alias: DishOff
trigger:
- entity_id: sensor.appliance_dishon
for: 0:01:00
from: 'on'
platform: state
to: standby
condition: []
action:
- data:
value_template: '{{ ((variable.state | int) + 1) }}'
variable: washing_offcount
service: variable.set_variable
- above: '1'
condition: numeric_state
entity_id: variable.washing_offcount
- data:
value: '0'
variable: washing_offcount
service: variable.set_variable
- data_template:
message: dish off {{ now()}}
service: persistent_notification.create
Lastly, in the event someone cancels mid-cycle, a timeout. The dish washer will power down for 10 minutes so a 15 minute timeout would indicate something abnormal.
- id: '1541081691156'
alias: DishOffTimeout
trigger:
- entity_id: sensor.appliance_dishon
for: 00:15:00
platform: state
to: 'off'
condition: []
action:
- above: '0'
condition: numeric_state
entity_id: variable.washing_offcount
- data:
value: '0'
variable: washing_offcount
service: variable.set_variable
- data_template:
message: dishwasher off by timeout {{ now() }}
service: persistent_notification.create
For notification just change the persistent_notification service to the notification of your choice.
Hope this helps.