Author is actively editing this guide. If you find error, plz report it.
Last Update:2024-10-21T19:00:00Z
This guide assumes that you already have.
A running instance of Home Assistant and accessible at: http://homeassistant.local:8123
Any google speaker (Google Home Mini/Nest)
Follow the following steps in same order.
Go to Settings tab in left side menu.
Click on Devices & Services.
Click on ADD INTEGRATION.
Search for Islamic Prayer Times and install it. Configure it and provide your coordinates (latitude and longitude) correctly. You will see an integration card like this:
Click on this integration card, and then configure it.
Brother,
Thank you very much for the code. I got it to work but there is one issue. The sensor has the data built on within it. That means the azan only works for one day. the next day would be say 14th but the sensor is still displaying 13th so it doesn’t work the next day.
OKay I figured out a way to solve this…
I scheduled a HA restart everyday. The the athan times sensor will reset the dates to match the dates of today.
The sensor data update automatically however it takes a lot time at first. If your configuration and automation files are the same as mine, azan should be heared every day at it’s correct time. I reckon your HA would update the sensor even with out restarting it on daily basis now. Just turn off daily restating and check it’s behaviour again.
Yes, you can do it. Make a new folder with name www in config/ and put your desired audio file in mp3 format in it. e.g. The path of this file should be config/www/myAudioFile.mp3
Then in your automation.yaml file change the following line as;
You can do this by adding time in seconds at the end of a template of your desired azan in automation.yaml file. In the example below, I have offset Fajar azan by 5 minutes.
I didn’t get that far… I am stuck at uploading a file. I was able to create ‘www’ directory under ‘/config’ but when i choose to upload the mp3 file it doesn’t do anything.
Update:
I managed to upload the file using scp. I installed ssh server and then just scp’d the files to /config/www directory.
ok so i tried using the file from www dir., and it didn’t work: media_content_id: http://hassio.local:8123/local/adhan_fajr_makkah.mp3
seems a bit flaky…
A simple trick to know whether your mp3 file is accessible on your network or not. Paste this url in any browser and see whether you get a notification to download adhan_fajr_makkah.mp3.
Hi @msahar, I need help, please. I have been following guides and so far I have managed to trigger the azan manually. But it seems it is not working via automation. I have Google Home. Home Assistant running on Raspberry Pi through Python3. As I said, the manual trigger works okay. Here are my configuration and automation yaml.
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 22.30691315
longitude: 113.918213569653
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 0
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: Asia/Shanghai
# Customization file
#customize: !include customize.yaml
#whitelist_external_dirs:
# - '/config/www'
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Show the introduction message on startup.
#introduction:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Discover some devices automatically
discovery:
media_extractor:
sun:
# Sensors
sensor:
# Weather prediction
- platform: yr
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
- 'time_date'
- 'time_utc'
- 'beat'
- platform: islamic_prayer_times
calculation_method: karachi
sensors:
- fajr
- sunrise
- dhuhr
- asr
- maghrib
- isha
- midnight
# Text to speech
tts:
- platform: google_translate
service_name: google_say
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
I commented #customize: !include customize.yaml #whitelist_external_dirs # - '/config/www' as I dont know what these do.
Hi @atique I have modified your both configuration and automation file. Please open your configuration.yaml file, delete all entries from it and then paste contents of configuration.yaml file that I have provided.
Thank you. I will give it a try and see if it works. Later I would like to have separate azan for Fajar to accommodate specific morning additional wordings Inshallah.
From your automation example, example and also from the youtube video I watched, I wonder how this below number is generated/obtained? Or is it any random number?
id: 1517693010922
id: 1517694139112
So for example, if I add separate triggers, how I sequence this number? Thank you.
These are just random numbers. You can modify. I will tell you how to modify automation.yaml for Fajar azan when you confirm about above solution whether working or not.
remains to today´s date. Is it supposed to change to tomorrow´s date now after having played already or it will auto update on date switching? Hopefully it will work on 14th Nov as well.
Can you please help with Fajar Adhan as a separate trigger? I tried now but it does not list on the card. It just says one trigger. In your youtube video it shows two triggers, Adhan and Fajar Adhan. Thanks in advance.