I use the following automation that triggers when the power usage drops below 10. It works, but annoyingly repeats again and again.
The original code was
alias: Tumble Dryer finished
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.tumble_dryer_power
for:
hours: 0
minutes: 0
seconds: 5
attribute: power
below: '10'
condition:
- condition: time
after: '10:00:00'
before: '22:00:00'
- condition: state
entity_id: input_boolean.mute_echos_switch
state: 'off'
action:
- service: notify.mobile_app_bobs_iphone
data:
message: Tumble dryer has finished
title: Home Assistant Alert!
- service: notify.alexa_media
data:
data:
type: announce
method: speak
message: The tumble dryer has finished
target:
- media_player.loungeecho
- media_player.kitchenecho
- service: notify.lounge_tv
data:
message: The tumble dryer has finished
mode: single
After doing some research I’ve tried the following code, but it’s not showing as valid?
alias: Tumble Dryer finished
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.tumble_dryer_power
for:
hours: 0
minutes: 0
seconds: 5
attribute: power
below: '10'
condition:
- condition: time
after: '10:00:00'
before: '22:00:00'
- condition: state
entity_id: input_boolean.mute_echos_switch
state: 'off'
- condition: template
value_template: "{{ ( as_timestamp(now()) - as_timestamp(state_attr('automation.tumble_dryer_finished.attributes.last_triggered', 'last_triggered')) |int(0) ) > 5 }}"
action:
- service: notify.mobile_app_bobs_iphone
data:
message: Tumble dryer has finished
title: Home Assistant Alert!
- service: notify.alexa_media
data:
data:
type: announce
method: speak
message: The tumble dryer has finished
target:
- media_player.loungeecho
- media_player.kitchenecho
- service: notify.lounge_tv
data:
message: The tumble dryer has finished
mode: single