https://secure.sayal.com/STORE2/locations.php
or amazon.ca
I personally prefer amazon
What you can do is to call a script that call the mp3 files or try to make 2 automatines, one that trigger the other, or you can combine 2 mp3 file in 1 files and this way play only the combined mp3 file, I didn’t try they, but I could test later with my Google home.
im 100% convinced that its not the speaker issue. Its either the code or the audio file, im starting to doubt that the mp3 file is not readible by the app (media_player) which is called by hass.io
Try convert to .wav
ok so its not the audio file as well, I’m stumped now.
# TEST BLOCK for Fajr Adhan
- alias: TEST BLOCK Fujr Adhan
id: '1517693010922'
trigger:
- platform: template
value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_time_fajr"), "%Y-%m-%dT%H:%M:%S")) +1140 }}'
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.wav
#media_content_id: https://www.islamcan.com/audio/adhan/azan2.mp3
media_content_type: 'music'
- delay: '00:03:06' # 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.wav
#media_content_id: https://www.islamcan.com/audio/adhan/azan2.mp3
media_content_type: 'music'
Try this
# Seperate Automation for Fajr Adhan
- alias: Fajr Adhan
id: '1517693010922'
trigger:
- platform: template
value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_time_fajr"), "%Y-%m-%dT%H:%M:%S")) +960 }}'
action:
- service: media_player.volume_set
data:
entity_id: media_player.hall_speaker
volume_level: '0.7'
- service: media_player.play_media
data_template:
entity_id: media_player.hall_speaker
media_content_id: http://hassio.local:8123/local/adhan_fajr_makkah.mp3
media_content_type: 'audio/mp3'
- delay: '00:02:05'
- service: media_player.play_media
data_template:
entity_id: media_player.hall_speaker
media_content_id: http://hassio.local:8123/local/adhan_duaa.mp3
media_content_type: 'audio/mp3'
just make sure you have access to your mp3 files through the URL.
so it triggers the speaker but nothing plays; i feel that the way this is coded is a problem?
I’ve updated it so that it reaches those files, triggers the speaker (i hear bleep) but that’s it.
# TEST BLOCK
- alias: TEST BLOCK Fajr Adhan
id: '1517693010922'
trigger:
- platform: template
value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_time_fajr"), "%Y-%m-%dT%H:%M:%S")) +960 }}'
action:
- service: media_player.volume_set
data:
entity_id: media_player.hall_speaker
volume_level: '0.7'
- service: media_player.play_media
data_template:
entity_id: media_player.hall_speaker
media_content_id: http://hassio.local:8123/local/adhan_fajr_makkah.mp3
media_content_type: 'audio/mp3'
- delay: '00:03:50'
- service: media_player.play_media
data_template:
entity_id: media_player.hall_speaker
media_content_id: http://khurram.org/aud/dua-e-adhan.mp3
media_content_type: 'audio/mp3'
UPDATE:
I think i have found the culprit but not sure what the solution is:
this address when played on on the browser, works: http://hassio.local:8123/local/adhan_fajr_makkah.mp3
but when i put that address in the code it doesn’t:
http://hassio.local:8123/local/adhan_fajr_makkah.mp3
or
http://localhost:8123/local/adhan_fajr_makkah.mp3
I’ve put the audio on the internal server on a local ip address and it works fine
weird! but i guess we can let this one go cause it could just be my internal network playing games.
- service: media_player.play_media
data_template:
entity_id: media_player.hall_speaker
media_content_id: http://hassio.local:8123/local/adhan_fajr_makkah.mp3
media_content_type: 'audio/mp3'
I tried to run this portion in service console and worked fine for me , i used google chrom cast.
I also created this automation and from service trigger it and worked fine, try instead of using hassio.local, use the ip address of your pi, like http://192.168.7.10:8123/local/adan.mp3
Hey Hassan, Thanks for your assistance so far. I’ve come across another interesting issue, im not sure if this is a limitation or not, but I can only play 2 files per trigger…
so lets say im playing adhan and then the dua after it… it wont go past that.
They should work try the url in a browser and see if you have access and it runs, if so it should work, make sure you have the delays well measured.
These work for me with a goole home mini:
# Play Adhan
- alias: Play Adhan
trigger:
- entity_id: input_boolean.adhan
from: 'off'
platform: state
to: 'on'
condition: []
action:
- service: media_player.play_media
data:
entity_id: media_player.living_room_speaker
media_content_id: http://10.10.10.12:8123/local/adhan-main.mp3
media_content_type: music
- delay: '00:00:10'
- service: input_boolean.turn_off
entity_id: input_boolean.adhan
- service: notify.ios_all
data:
message: 'It is {{ states.sensor.salah_actual.state }} time, please perform wudhu.'
# Play Adhan Fajr
- alias: Play Adhan Fajr
trigger:
- entity_id: input_boolean.adhan_fajr
from: 'off'
platform: state
to: 'on'
condition: []
action:
- service: media_player.play_media
data:
entity_id: media_player.living_room_speaker
media_content_id: http://10.10.10.12:8123/local/adhan-fajr.mp3
media_content_type: music
- delay: '00:00:10'
- service: input_boolean.turn_off
entity_id: input_boolean.adhan_fajr
- service: notify.ios_all
data:
message: 'It is {{ states.sensor.salah_actual.state }} time, please perform wudhu.'
Brother Thanks for the guide, It was easy to follow and I was able to setup.
my only issue now is if i change the calculation_method from mwl to isna in the configuration.yaml file it doesn’t work. am i suppose to do anything else other than just changing the mwl to isna.
Please show us screenshots of your automation.yaml, configuration.yaml and sensor state (Developer tools -> States) for further investigation.
make sure also your longitude and latitude are corresponds to your location
Salam Alikoum, I successfully got work this athan sensor ,and I changed calculated method to isna and I reload the scripts automations , and now the sensors didn’t get changed till restart control server, so I have to restart it every day to make it work, i updated the ha to the last version but still not working. Did someone get same issue? What’s the solution? Jazakoum allahou khayrane
My guess, without further diving in: you didn’t enable your time sensor in HA.
Enable and try again. Without enabling time_date the automation is only triggered when you restart…
Thanks for replay, this is already done in configuration.yaml . Ant it works before I added some other sensors like environemt_ canada platform, is there any log file can i check the log
I too continue to struggle with time adhan sensors updating to newer date and time. They continue to stuck there for a while and get update at some random hour in the day. That means sometimes Fajar and Duhar azan never gets played. I have all done correct set-up but still …