Skip to content

Instantly share code, notes, and snippets.

@OJ7
Last active April 28, 2026 16:20
Show Gist options
  • Select an option

  • Save OJ7/7f773927d99fe77933e8c7d96a70b6cd to your computer and use it in GitHub Desktop.

Select an option

Save OJ7/7f773927d99fe77933e8c7d96a70b6cd to your computer and use it in GitHub Desktop.
Automate Playing Adhan on Google Home (using Home Assistant)
# Automation for Dhuhr, Asr, Maghrib, and Isha Adhan
- action:
- alias: ''
data:
entity_id: media_player.family_room_speaker # replace with your Google Home's id
media_content_id: https://www.youtube.com/watch?v=ADLO-Hm_nCQ # replace with your choice of Adhan
media_content_type: audio/youtube
service: media_extractor.play_media
- data:
entity_id: media_player.family_room_speaker # replace with your Google Home's id
volume_level: '0.7'
service: media_player.volume_set
alias: Adhan
condition: []
id: '1517693010922'
trigger:
- platform: template
value_template: '{{ states.salat.dhuhr.state == states.sensor.time.state }}'
- platform: template
value_template: '{{ states.salat.asr.state == states.sensor.time.state }}'
- platform: template
value_template: '{{ states.salat.maghrib.state == states.sensor.time.state }}'
- platform: template
value_template: '{{ states.salat.isha.state == states.sensor.time.state }}'
# Separate Automation for Fajr Adhan
- action:
- data:
entity_id: media_player.family_room_speaker # replace with your Google Home's id
media_content_id: https://www.youtube.com/watch?v=VHcRTIcRvN8 # replace with your choice of Fajr Adhan
media_content_type: audio/youtube
service: media_extractor.play_media
- data:
entity_id: media_player.family_room_speaker # replace with your Google Home's id
volume_level: '0.99'
service: media_player.volume_set
alias: Fajr Adhan
condition: []
id: '1517694139112'
trigger:
- platform: template
value_template: '{{ states.salat.fajr.state == states.sensor.time.state }}'
@naseemr

naseemr commented Aug 19, 2019

Copy link
Copy Markdown

is there a way to display only the prayer time, not the date?

@OJ7

OJ7 commented Aug 25, 2019

Copy link
Copy Markdown
Author

is there a way to display only the prayer time, not the date?

@naseemr If you follow this method, you should only get the timings.

If you have a date, you may be able to use something like this to convert to timings only.

@naseemr

naseemr commented Sep 4, 2019

Copy link
Copy Markdown

Hi,
I have a date sensor, but not able to use template, giving me error :{{(strptime(states("sensor.islamic_prayer_time_asr"),"" )) "%H:%M, %Y-%m-%d"}}

@msanaullahsahar

msanaullahsahar commented Sep 6, 2019

Copy link
Copy Markdown

I have google home mini and I am trying to get this setup on them.
I am new to this and Need a starting point. Do we install this on a desktop thats on the same network as Google home?

how do we install this script on google home? I am very confused. Please help.

Start with this tutorial. It is written step by step.
[https://community.home-assistant.io/t/adhan-automation-prayer-calls-using-home-assistant-and-google-home-mini/135622]

https://community.home-assistant.io/t/adhan-automation-prayer-calls-using-home-assistant-and-google-home-mini/135622

@highwingers

highwingers commented Dec 11, 2019

Copy link
Copy Markdown

I developed a much simpler version to automate Azan. Simple 1 click install. details below
https://www.smartazan.com/

For technical support, please visit smartazan.com.

@msanaullahsahar

msanaullahsahar commented Dec 11, 2019 via email

Copy link
Copy Markdown

@highwingers

highwingers commented Dec 11, 2019 via email

Copy link
Copy Markdown

@azeemsarwaraus

Copy link
Copy Markdown

@highwingers: thanks a lot for your program. it is only for USA states, what about other countries please

@OJ7

OJ7 commented Apr 20, 2020

Copy link
Copy Markdown
Author

I've created an alternative version with minimal setup (just requires any device that can run Python, e.g. can run on Raspberry Pi). I haven't fully tested it but inshaAllah it should work fine.

https://github.com/OJ7/AdhanCast

@notbillable

Copy link
Copy Markdown

With Ramadan coming up would really like a simplified way of having Azan played automatically on Google home without having to run an application on my home computer 24/7?

@highwingers

Copy link
Copy Markdown

Thats great but I wonder who would leave leave there computer running 24/7 for an azan service. Turning monitor off would not help enough. Can you think of running this service on a raspberry pi?

Reaspberry pi version is ready. I would need someone to test it. let me know if you are interested.

@highwingers

Copy link
Copy Markdown

@highwingers: thanks a lot for your program. it is only for USA states, what about other countries please

its been updated for world wide usage now.

@highwingers

Copy link
Copy Markdown

Thats great but I wonder who would leave leave there computer running 24/7 for an azan service. Turning monitor off would not help enough. Can you think of running this service on a raspberry pi?

Raspberry version is ready. please let me know if you want to test it...www.Smartazan.com

@msanaullahsahar

msanaullahsahar commented Jul 25, 2020 via email

Copy link
Copy Markdown

@highwingers

Copy link
Copy Markdown

Thats great but I wonder who would leave leave there computer running 24/7 for an azan service. Turning monitor off would not help enough. Can you think of running this service on a raspberry pi?

Please try the Raspberry pi version. https://www.smartazan.com/how-azan-for-google-home-raspberry-pi

@hammams

hammams commented Oct 4, 2020

Copy link
Copy Markdown

@highwingers Smartazan rocks. Have it running on windows and seems to be working well. Keep up the good work.

@zeegemstar

zeegemstar commented Feb 28, 2021

Copy link
Copy Markdown

(off topic)

@zeegemstar

zeegemstar commented Feb 28, 2021

Copy link
Copy Markdown

(off topic)

@highwingers

Copy link
Copy Markdown

@highwingers Also download multiple Azaan MP3 locally on computer in Data folder instead of referencing it on your website you are assuming every machine will be connected to public internet which will have access to internet always. You can give user an option through your UI to update local machine whenever you have any update on your website that way each install is not dependent on your website and can run independently without any external dependency.

Google Home Speakers will NOT play local files, it has to hosted on HTTP server. Now I can install local web server to host files, however users would run into many issues (Such as LAN's VLAN;s Firewall etc etc). This is why I left the Adhan file field editable, so users can feel free to host their Adhan anywhere they want.

@highwingers

highwingers commented Feb 28, 2021

Copy link
Copy Markdown

(off topic)

@n1zeee

n1zeee commented Mar 5, 2021

Copy link
Copy Markdown

(off topic)

@OJ7

OJ7 commented Mar 5, 2021

Copy link
Copy Markdown
Author

@highwingers, can you please provide a contact address so everyone doesn't get notified for tech support?

@highwingers

Copy link
Copy Markdown

@highwingers, can you please provide a contact address so everyone doesn't get notified for tech support?

Yes. Please visit SmartAzan.com and send all qiestions through the website.

@24515

24515 commented Feb 7, 2023

Copy link
Copy Markdown

(spam posts removed)

@AceCanProgram

Copy link
Copy Markdown

does this require a raspberry pi, i'd prefer to only need my phone or my computer and my nest mini.

@OJ7

OJ7 commented Feb 27, 2023

Copy link
Copy Markdown
Author

does this require a raspberry pi, i'd prefer to only need my phone or my computer and my nest mini.

If you're going the Home Assistant route, you can install it on a variety of devices: see here

@highwingers' SmartAzan.com has a variety of devices you can use if you only want the adhan played (note: I haven't tried this method).

@AceCanProgram

Copy link
Copy Markdown

does this require a raspberry pi, i'd prefer to only need my phone or my computer and my nest mini.

If you're going the Home Assistant route, you can install it on a variety of devices: see here

@highwingers' SmartAzan.com has a variety of devices you can use if you only want the adhan played (note: I haven't tried this method).

I have a linux computer, what is the route I should take for that? Also do I really need to create a virtual machine for home assistant?

@highwingers

highwingers commented Feb 27, 2023 via email

Copy link
Copy Markdown

@highwingers

highwingers commented Feb 27, 2023 via email

Copy link
Copy Markdown

@t-abraham

t-abraham commented Nov 18, 2023

Copy link
Copy Markdown

(off topic)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment