I have been trying to have an audio file play in an automation that uses motion detection as a trigger. I have read several posts regarding how to do this but can’t get it to work. I built it using the UI. I am running on a Raspberry Pi 4 HA version 2022.5.0. If I have include a light in the automation that will turn on but the media fie won’t play yet it runs in test action. The yaml and UI below are with just the Play Media. Any help would be really be appreciated. All my other non motion based automations with Play Media work.
Here is the file:
alias: Automation Test
description: ‘’
trigger:
- type: motion
platform: device
device_id: 25f78051988c764780d04ae94d99a33a
entity_id: binary_sensor.front_entry_motion
domain: binary_sensor
condition: []
action: - service: media_player.play_media
target:
entity_id: media_player.dining_room_sonos
data:
media_content_id: media-source://media_source/local/Door-creaking-sound.mp3
media_content_type: audio/mpeg
metadata:
title: Door-creaking-sound.mp3
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
mode: single
This is what the UI looks like:
Dan