“Almost done” announcement

Hello,

I want to let my google speaker announce when certain devices are allmost done. So for example when the dishwasher or washing machine is done in 5 minutes, i want to announce that, so 5 minutes before its actually done…

Iv’e read something about a timer… is this the way to do it?

A little help with code is appreciated…

Do you already actually have a sensor that tells you when those devices will be done?

Yes… there are sensors that are counting down

you say “counting down”.

Is it a datetime sensor that gives you a time when it should be done or a counter of minutes left or something else?

if they are datetime sensors you can use a template to trigger 5 minutes before the done time value and use that to make the announcement.

1 Like

It’s a counter that shows for example: “in 9 minutes the washer will be done” and it counts down

I don’t think there is any sensor that has that as a state. At least anything built-in.

can you go to the developers tools–>states tab and post a screenshot of the sensor that represents that time value?

I don’t use google speakers so I can’t tell you what action to use for tts on your speaker but this should trigger it:

alias: washer almost done announcement
trigger:
  - platform: template
    value_template: "{{ as_timestamp(now()) > as_timestamp(states('sensor.wasmachine_washer_completion_time')) - 300 }}"
action:
  - action: whatever_your_media_player_needs_for_tts

i got the error: Message malformed: invalid template (TemplateSyntaxError: unexpected ‘}’, expected ‘)’) for dictionary value @ data[‘value_template’]

alias: washer almost done announcement
trigger:
  - platform: template
    value_template: "{{ as_timestamp(now()) > as_timestamp(states('sensor.wasmachine_washer_completion_time')) - 300 }}"
action:
  - action: whatever_your_media_plater_needs_for_tts

Small typo in the code posted, added an additional ) after _time’)

i’ve changed the string to: value_template:

“{{ as_timestamp(now()) - as_timestamp(states.sensor.wasmachine_washer_completion_time.last_changed) - 300 }}”

This seems to be acceptable… but it doesnt trigger the action

Great, this works… thnx!

Glad it does!

FYI. Likely best to wait until @finity edit’s his post and then give him the Solution :white_check_mark: vs. my response - which merely caught a quick typo. I’m definitely not trying to steal his credit :wink:

2 Likes

yup. thanks for the correction.

my post is fixed now.