You need to use media extractor to play the youtube version of the Athan.
first add media extractor anywhere in your configuration.yaml file like this:
media_extractor:
Next use media extractor to play the audio of that youtube video, here’s my automation.
Just for any passers by. Make sure you have the right timezone in your configuration file. I’m in London and i had utc set as my time zone so this wasnt working as expected.
Hello Aadighal, I’ve been struggling since few days to get the automation , I can manually trigger it and the Adhan plays. Possible to share your config and automation files? any help would be appreciated.
Unfortunately you can’t enter a value template in the Automation editor GUI, to go around that you could create an automation and use a template trigger but leave the value template empty and fill out the rest. Then go to your automation.yaml file and add the value template there. Here’s a picture of the my automation in the Automation editor.
Thank you. I appreciate your offer. Please give us a detailed tutorial. May Allah reward all of you for making our homes filled with the voice of Azaan.
Hi, you can add them to folder and then play all the mp3 files either *.mp3 or you can use Delay: (time for file to end playing) then play the next file and so on, this way you will have a playing order.
This is an example to play random files
- service: shell_command.bienvenida
data_template:
tocar: "/zara/music/saludos/saludos1.mp3"
- delay: '00:01:55' # this is the time it takes to finish playing the saludos1.mp3 file.
- service: shell_command.bienvenida
data_template:
tocar: "/zara/music/saludos/saludos2.mp3"
Shell command:
bienvenida: /usr/bin/mpg123 -a hw:0,0 -q "{{tocar}}"
The “hw:0,0” is the audio hardware if you are using the raspberry and have speakers attached to the raspberry.
i have just rearrange your automation and added delay and “another adhan_duaa.mp3” file as another mp3 file to play.
hope it works.
mjust make sure that the time on the delay its grater than the time your adhan fajir takes by lets say 3 seconds.
what im thinking, not sure if this is correct: value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == 18:30:00, "%H:%M:%S"))}}'
So i created a test block: which doesn’t give me error but doesn’t do much: im assuming the issue is the way i have entered a specific time under value_template…
- alias: TEST BLOCK
id: '1517693010922'
trigger:
- platform: template
value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp("18:15:00", "%H:%M:%S") }}' #so the current time from time_date is 18:10
action:
- service: media_player.volume_set
data:
entity_id: media_player.office_speaker
volume_level: '0.7'
- service: media_extractor.play_media
data:
entity_id: media_player.office_speaker
media_content_id: http://hassio.local:8123/local/adhan_fajr_makkah.mp3
media_content_type: audio/mp3
- delay: '00:03:50' # time it takes to finish playing your adhan_fajr_makkah.mp3
- service: media_extractor.play_media
data:
entity_id: media_player.office_speaker
media_content_id: http://hassio.local:8123/local/dua-e-adhan.mp3
media_content_type: audio/mp3