Play Local Sound Through PiMusicBox

Tags: #<Tag:0x00007f326c865b00>


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
    - platform: state
      entity_id: binary_sensor.door_garage_sensor
      from: 'off'
      to: 'on'
    condition: state
    entity_id: binary_sensor.door_garage_sensor
    state: 'on'
    service: media_player.play_media
      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 ?

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: