remcovdwal
(remcovdwal)
September 11, 2024, 7:54pm
1
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…
finity
September 12, 2024, 4:50pm
2
Do you already actually have a sensor that tells you when those devices will be done?
remcovdwal
(remcovdwal)
September 13, 2024, 7:14pm
3
Yes… there are sensors that are counting down
finity
September 14, 2024, 12:14am
4
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
remcovdwal
(remcovdwal)
September 14, 2024, 7:20am
5
It’s a counter that shows for example: “in 9 minutes the washer will be done” and it counts down
finity
September 15, 2024, 1:28am
6
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?
finity
September 15, 2024, 9:45am
8
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
remcovdwal
(remcovdwal)
September 15, 2024, 3:49pm
9
i got the error: Message malformed: invalid template (TemplateSyntaxError: unexpected ‘}’, expected ‘)’) for dictionary value @ data[‘value_template’]
Markus99
(Mark)
September 15, 2024, 3:51pm
10
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’)
remcovdwal
(remcovdwal)
September 15, 2024, 4:06pm
11
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
Markus99
(Mark)
September 15, 2024, 5:23pm
13
Glad it does!
FYI. Likely best to wait until @finity edit’s his post and then give him the Solution vs. my response - which merely caught a quick typo. I’m definitely not trying to steal his credit
2 Likes
finity
September 16, 2024, 2:55am
14
Markus99:
a quick typo
yup. thanks for the correction.
my post is fixed now.