Play sound when time is 22:00

hello everbody i am trying play a sound when are 22:00.

i instaled two amplified speakers in my raspberry pi.

then i installed omxplayer 
sudo apt-get install omxplayer -y

after i created 

shell_command.yaml and inside i put

shell_command:
play_sound: omxplayer /homepi/musica/teste.mp3


after i create 
automation.yaml and inside i put

- alias: teste
  trigger:
    platform: time
    after: '22:00:00'
  action:
    service: shell_command.play_sound

but the sound not play...what is wrong?

Please use the preformatted text option when posting code so that your formatting is preserved. This makes it easier for people to help you.

Highlight your code blocks and press the preformatted text button like so:

1 Like

but is i go CMD and write
pi@raspberrypi:~ $ omxplayer teste.mp3

works, why on HA doesn´t work?

Try this - you may have to adjust the path to reflect your player:

shell_command:
 play_sound: sudo /usr/bin/omxplayer /homepi/musica/teste.mp3

for testing i can go to:
dev tools
SERVICE
Domain: shell_command
service: play_sound

and click

CALL SERVICE

These steps should be works for testing?

how i know if omxplayer is instaled on /usb/bin? in my SAMBA Only see the folders HASS, and HOMEPI

Use console and change to the directory and do an ls. Pretty sure that is the correct path though.

This is why I use WinSCP though; you can connect as root and navigate the entire Pi. It’s kind of like the old Norton Commander - two window interface with local machine on left, Pi on the right.

ok rpitera already verified and i have omxplayer inside /usr/bin
and inside my shell_comand.yaml

sudo /usr/bin/omxplayer /homepi/musica/teste.mp3 but not working ,grrrrrrr
missing something??

This is where I got that from; maybe something it the thread will help you.

1 Like

rpitera thanks i find the problem… the problem was the folder…

on windows/samba i see /homepi/musica/teste.mp3
on SCP i see /home/pi/musica/teste.mp3

then the problem is the folder not HOMEPI but HOME/PI

thanks for help me.

1 Like