#simple sound automation

1 messages · Page 1 of 1 (latest)

prime wasp
#

Sorry, I'm still learning. This is my 1st "sound" automation but I guess I don't understand the pieces involved with media_player and VLC etc.

I have HAOS 16.0 (2025.7.3) on a RPi5 with usb speaker.
I can trigger an email to when my insteon open/close door sensor stays open for n minutes.

Now I want to play a sound on the locally attached speaker.

  1. I uploaded the wave file to /media/alarms/alarm.wav
  2. Added this to my configuration.yml (and restarted)
shell_command:
  play_alarm: 'aplay /media/alarms/alarm.wav'
  1. Created the automation in the ui with action
  - action: shell_command.play_alarm
    data: {}

but I don't hear it playing. If I log into my haos node and play the file with aplay I hear it just fine.

Then I tried creating an action in the UI where I specify the target device, Content ID, and Content Type.

Content ID: always http://<haos-address>/media/alarms/alarm.wav
Content Type: always music
For Target I tried these

"All Speakers" <<-- I get a sound on my Nest speakers but not the wav file.
"VLC Telnet" <<-- Nothing happens

So how do I specify the locally attached speaker as the target?
Do I even need VLC Integration and Add on here?

prime wasp
#

The tts.speak action also works with my Nest speakers.

  - action: tts.speak
    metadata: {}
    data:
      cache: true
      media_player_entity_id: media_player.office_speaker
      message: The front door is open.
    target:
      entity_id: tts.google_translate_en_com

I just dont understand how to send to my locally attached speaker.

latent talon
#

Does the trace or logs for the automation show anything interesting?

Also, if you don't mind me asking, can I see the YAML for this portion?
"I can trigger an email to when my insteon open/close door sensor stays open for n minutes. "

prime wasp
# latent talon Does the trace or logs for the automation show anything interesting? Also, if y...

I removed the VLC addon & integrations. Here's the yaml.

- id: '1753365070968'
  alias: FrontDoorOpen
  description: ''
  triggers:
  - trigger: state
    entity_id:
    - binary_sensor.open_close_sensor_4e_39_b8
    to: 'on'
    from: 'off'
    for:
      hours: 0
      minutes: 2
      seconds: 0
  conditions: []
  actions:
  - action: tts.speak
    metadata: {}
    data:
      cache: true
      media_player_entity_id: media_player.office_speaker
      message: The front door is open.
    target:
      entity_id: tts.google_translate_en_com
  - action: notify.my_email_gmail_com
    metadata: {}
    data:
      message: Front Door is Open
      title: Door Left Open
      target: me@gmail.com
      data:
        from: me@gmail.com
  - action: media_player.play_media
    data:
      media_content_type: music
      media_content_id: http://a.b.c.d/media/alarms/alarm.wav
    target:
      device_id: b9fdfc79266eb02a0ce79a9338a185e3
  mode: single
#

I don't see anything under traces, but this un home-assistant.log

2025-07-26 07:50:25.963 ERROR (Thread-14) [homeassistant.components.cast.media_player] Failed to cast media http://a.b.c.d/media/alarms/alarm.wav. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address

latent talon
#

I can't tell if that is a fake url for privacy reasons or not. The error seems to indicate it can't reach the resource. is the cast device and HA machine on same VLAN?

prime wasp
#

a.b.c.d is the ip address of my HAOS machine.
Actually I changed the action to this and it works, I get a "bling sound" followed by the alarm.wav on all my cast speakers.

  - action: media_player.play_media
    data:
      media_content_type: music
      media_content_id: media-source://media_source/media/alarms/alarm.wav
    target:
      device_id: c8a9e180d494ac079d057c5e35e23e06

Don't know how to lookup the device_id but I selected my "All speakers" in the UI.

#

Now I'd just like to know how to play teh sound on the locally connected usb speaker.

I know the HaOS machine is a "server" and you'd normally want to trigger notifications on some "client" device.
But since the HaOS machine sits in my office (where I am all day) I'd like to be able to just play the notification locally.

lone crest
#

You might have some luck bypassing the idea of using a media player and go straight for a shell execution, assuming you can install the needed tools and the HA access to the sound devices. But I believe that playback from the HA machine itself is pretty odd and I wouldn’t expect you to get much help getting this going.