There are a number of good Blueprints for this kind of thing, here are links to two that I have used:
“Appliance Notifications and Actions…” by Blacky
“Notify or Do Something When an Appliance…” by sbyx
That’s what I do as well. Because the vibration sensor I have can be a little bouncy, I use a Template Binary sensor with delays to avoid false positives
Binary Sensor configuration
template:
- binary_sensor:
- name: Dryer Active
unique_id: dryer_active_0001
device_class: running
state: "{{ is_state('binary_sensor.zb_vibration_01', 'on') }}"
delay_on: "00:00:30"
delay_off: "00:01:00"
attributes:
test: "{{now()}}"
The following is the automation that uses that sensor as its trigger. It includes a template condition to check that the dryer was active for at least 30 minutes to avoid announcements when someone is just using the dryer for a quick de-wrinkle.
alias: Notify - Dryer - Cycle Complete
description: ""
mode: single
triggers:
- trigger: state
entity_id:
- binary_sensor.dryer_active
from: "on"
to: "off"
for: "00:02:00"
id: complete
conditions:
- alias: The dryer was previously on for at least 30 minutes
condition: template
value_template: >
{{ now() - trigger.from_state.last_changed >= timedelta(minutes=30) }}
actions:
- action: assist_satellite.announce
data:
preannounce_media_id:
media_content_id: media-source://media_source/local/Sound_Effects/minuet.mp3
media_content_type: audio/mpeg
message: The Dryer has completed its cycle.
target:
entity_id: assist_satellite.home_assistant_voice
Yes. It can play an audio file on its own as shown below, or as a preannounce sound as shown in the automation above.
If you have the file locally, make sure it’s in a folder set to be accessible as a media source.
You can also specify a URL for non-local files:
action: media_player.play_media
target:
entity_id: media_player.home_assistant_voice
data:
media_content_type: music
media_content_id: "https://sound-effects-media.bbcrewind.co.uk/mp3/07071033.mp3"