Play Local Sound Through PiMusicBox

Tags: #<Tag:0x00007f326c865b00>

Hello,

I want to play a local mp3 (dog barking) on PiMusicBox (installed on RaspberryPi) if my door sensor is open, my HomeAssistant is a VM on VMWare ESXi.

Bluetooth Speaker is connected to PiMusicBox with an jack cable and everything works fine.

Here is my automations.yaml

- alias: Play Sound si Garage Ouvert
  trigger:
    - platform: state
      entity_id: binary_sensor.door_garage_sensor
      from: 'off'
      to: 'on'
  condition:
    condition: state
    entity_id: binary_sensor.door_garage_sensor
    state: 'on'
  action:
    service: media_player.play_media
    entity_id: media_player.md
    data:
      media_content_id: http://192.168.1.36:8123/local/sound/dogs.mp3
      media_content_type: music

My mp3 is reachable and can be play if I test URL in a browser.

binary_sensor.door_garage_sensor is my sensor to detect opened door
md is my PiMusicBox entity

My conditions works, I test with an other alias to send me notifications trough Home Assistant companion

When I execute my Play Sound si Garage Ouvert automation, nothing happen and no errors in logs, I can play sound with a media player card on Lovelace but it’s only radios store on PiMusicBox.

Any Ideas ?

bonjour,
j’ai du mal a suivre ton automatisation
en bon francais:
“joue le son -> quand le ‘sensor’ passe de ‘off’ a ‘on’, a condition qu’il soit sur ‘on’.”
Si tu veux jouer un son quand ton sensor s’ouvre (ou se ferme) pourquoi mettre une condition?

Effectivement c’est inutile mais même en supprimant la condition le son ne se joue pas …

It works, it was a mistake in my entity id :woozy_face: