Automate Islamic Adhan (also called Azan or Azzan) or other prayer calls - Updated 3_24_2023 for Node-RED

Hi guys,

I am new here so need help first of all…everyone done great jobs

so I am looking to display let say fajr time still as true or active in between within until 1 hour after fajr time. so let say it is 6am until 7 am it will show me that still time to pray.

value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M,
%Y-%m-%d”)) > as_timestamp(strptime(states(“sensor.dhuhr_prayer”), “%Y-%m-%dT%H:%M:%S”))
}}’

thank you for help !!!

Hi Guys, i am a newbie and having issues running the adhaan. Configuration is below:
homeassistant:

Name of the location where Home Assistant is running

name: Home

Location required to calculate the time the sun rises and sets

latitude: -35.473469
longitude: 149.012375

Impacts weather/sunrise data (altitude above sea level in meters)

elevation: 719m

metric for Metric, imperial for Imperial

unit_system: metric

Pick yours from here: List of tz database time zones - Wikipedia

time_zone: Australia/ACT

Customization file

customize: !include customize.yaml
whitelist_external_dirs:
- ‘/config/www’

Show the introduction message on startup.

#introduction:

Discover some devices automatically

discovery:

media_extractor:

#Sensors
sensor:

Weather prediction

  • platform: yr

  • platform: time_date
    display_options:

    • ‘time’
    • ‘date’
    • ‘date_time’
    • ‘time_date’
    • ‘time_utc’
    • ‘beat’
      #sensor:
  • platform: islamic_prayer_times
    calculation_method: makkah
    sensors:

    • fajr
    • sunrise
    • dhuhr
    • asr
    • maghrib
    • isha
    • midnight

Text to speech

tts:

  • platform: google translate

service_name: google_say

#Google Home
cast:
media_player:
#- host: xxx.xxx.x.xxx #Google Home Mini
- host: xxx.xxx.x.xxx #Google Nest Hub

#input Boolean - used to synchronize between multiple speakers
input_boolean:
adhan:
name: Adhan
initial: off

sensor:
media_extractor:

Automation.yaml:

Automation for Dhuhr, Asr, Maghrib, and Isha Adhan

  • action:
    • alias: ’ ’
      data:
      entity_id: media_player.family_room_speaker
      media_content_id: https://www.islamcan.com/audio/adhan/azan5.mp3 # replace with your choice of Adhan
      media_content_type: audio/mp3
      service: media_extractor.play_media
    • data:
      entity_id: media_player.family_room_speaker
      volume_level: ‘0.7’
      service: media_player.volume_set
      alias: Adhan
      condition: [ ]
      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_dhuhr”), “%Y-%m-%dT%H:%M:%S”))+240 }}’
    • platform: template
      value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.islamic_prayer_time_asr”), “%Y-%m-%dT%H:%M:%S”))+3960 }}’
    • platform: template
      value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.islamic_prayer_time_maghrib”), “%Y-%m-%dT%H:%M:%S”))+360 }}’
    • platform: template
      value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.islamic_prayer_time_isha”), “%Y-%m-%dT%H:%M:%S”))-2220}}’

Separate Automation for Fajr Adhan

  • action:
    • alias: ‘’
      data:
      entity_id: media_player.family_room_speaker # replace with your Google Home’s id
      media_content_id: https://www.islamcan.com/audio/adhan/azan1.mp3

      replace with your choice of Fajr Adhan

      media_content_type: audio/mp3
      service: media_extractor.play_media
    • data:
      entity_id: media_player.family_room_speaker # replace with your Google Home’s id
      volume_level: ‘0.5’
      service: media_player.volume_set
      alias: Fajr Adhan
      condition: [ ]
      id: ‘1517694139113’
      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”))+1200 }}’

you can try to use the following code to adjust SG prayer time.


  - platform: template
    sensors:
      salah_fajr:
        friendly_name: "Fajr"
        value_template: "{{ (as_timestamp(states('sensor.fajr_prayer')) - 480) | timestamp_custom('%Y-%m-%dT%H:%M:%S+00:00', false) }}"
        device_class: timestamp

  - platform: template
    sensors:
      salah_dhuhr:
        friendly_name: "Dhuhr"
        value_template: "{{ (as_timestamp(states('sensor.dhuhr_prayer')) + 60) | timestamp_custom('%Y-%m-%dT%H:%M:%S+00:00', false) }}"
        device_class: timestamp

Hi, thank you but I solved this a few years ago…

How did you solve it? any dynamic way?

I’m using Node-Red with HomeAssistant. So the time adjustment is done in Node-Red. Previously I did something like what you posted… I think I posted it somewhere in this thread or the original thread for this integration.

Because Ramadan is approaching, I was considering creating an automation that would send me a voice alert on my google speaker 10 minutes before iftar. What is the best way for me to do this?

Just use the method posted above for an offset of -10 :

* Template warning: 'strptime' got invalid input '2022-04-21T18:20:00+00:00' when rendering template '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.dhuhr_prayer"), "%Y-%m-%dT%H:%M:%S")) }}' but no default was specified. Currently 'strptime' will return '2022-04-21T18:20:00+00:00', however this template will fail to render in Home Assistant core 2022.1

I keep getting this error. Does anyone know how to resolve it or what can I use to replace ‘strptime’? If someone could point in the right direction, I would appreciate it.

I found a solution from another post. I am going to link his answer here. Azan or Adhan automation Islamic Prayer Times - #5 by 123 Thanks @123

Hello, with latest ha version the get template has error.
Do you have a workaround please

My adhan automation stopped working after updating to latest version

Dear all my brothers & sisters,

After the recent update on my HA, my Adhan suddenly stop working, upon searching the error in log, it’s likely due to the time template.

For those who have similar issues, please refer below ‘before’ and ‘after’ changes in my template.

BEFORE

- platform: template
  sensors:
    subuh_selangor:
      friendly_name: 'Subuh'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Fajr"] | timestamp_custom("%H:%M") }}'
    zuhur_selangor:
      friendly_name: 'Zuhur'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Dhuhr"] | timestamp_custom("%H:%M") }}'
    asar_selangor:
      friendly_name: 'Asar'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Asr"] | timestamp_custom("%H:%M") }}'
    maghrib_selangor:
      friendly_name: 'Maghrib'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Maghrib"] | timestamp_custom("%H:%M") }}'
    isyak_selangor:
      friendly_name: 'Isyak'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Isha"] | timestamp_custom("%H:%M") }}'

AFTER

- platform: template
  sensors:
    subuh_selangor:
      friendly_name: 'Subuh'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Fajr"] }}'
    zuhur_selangor:
      friendly_name: 'Zuhur'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Dhuhr"] }}'
    asar_selangor:
      friendly_name: 'Asar'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Asr"] }}'
    maghrib_selangor:
      friendly_name: 'Maghrib'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Maghrib"] }}'
    isyak_selangor:
      friendly_name: 'Isyak'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Isha"] }}'

MY WORKABLE FULL CONFIGURATION

#Time Data
- platform: time_date
  display_options:
    - 'time'
    - 'date'
    - 'date_time'
    - 'time_date'
    - 'time_utc'
    - 'beat'

#selangor
- platform: rest
  name: "Prayer selangor"
  json_attributes:
    - data
  resource: "http://api.aladhan.com/v1/timings?latitude=3.333333&longitude=333.33333&method=3"
  value_template: '{{ value_json["data"]["meta"]["method"]["name"].title() }}'
  scan_interval: 86400

- platform: template
  sensors:
    subuh_selangor:
      friendly_name: 'Subuh'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Fajr"] }}'
    zuhur_selangor:
      friendly_name: 'Zuhur'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Dhuhr"] }}'
    asar_selangor:
      friendly_name: 'Asar'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Asr"] }}'
    maghrib_selangor:
      friendly_name: 'Maghrib'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Maghrib"] }}'
    isyak_selangor:
      friendly_name: 'Isyak'
      value_template: '{{ states.sensor.prayer_selangor.attributes.data.timings["Isha"] }}'

In summary what i did, is to remove the ‘timestamp_custom’ line from the template. Hope it helps.

If you want to keep the timestamp_custom filter, this is what it should look like now that de default parameter is a required parameter:

timestamp_custom("%H:%M", default = 0)

Updating Templates with the new default values in 2021.10.x

Edwin

i tried your above method but got all my time 0.
tttttt

That would normally happen if the value before is undefined. Wat exactly is displayed if you remove ithe filter entirely?

Hello, I am using version 2022.7.4, I have installed islamic prayer times, all is well, but the adhan won’t go off automatically. I have put my configuration files below for your idea. The scripts below used to work on an extremely old version of HA that I was running for the past few years. Since my old raspberry died, I’ve put this on a vmware esxi server for more stability. Please let me know if you can see what am I missing.

config/configuration.yaml

homeassistant:
latitude: 43.21824
longitude: -79.7875487
elevation: 106
unit_system: metric
time_zone: America/Toronto

default_config:
discovery:
media_extractor:
sun:

sensor:

  • platform: time_date
    display_options:
    • ‘time’
    • ‘date’
    • ‘date_time’
    • ‘date_time_iso’
    • ‘time_date’
    • ‘time_utc’
    • ‘beat’
  • platform: islamic_prayer_times
    calculation_method: isna
    sensors:
    • fajr
    • sunrise
    • dhuhr
    • asr
    • maghrib
    • isha
    • midnight

Text to speech

tts:

  • platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

config/automation.yaml

Fajr Adhan

################################################################################

  • alias: 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”)) -3600 }}’ # Activate this in November right after the time change

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”)) +3600 }}’ # Activate this in March right after the time change

  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")) }}'       # Always the Normal

action:
- service: media_player.volume_set
data:
entity_id:
- media_player.family_room_speaker
- media_player.master_bedroom_speaker
volume_level: ‘0.40’

# Fujr Adhan
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.master_bedroom_speaker
    media_content_id: http://192.168.1.160/aud/adhan/adhan_fajr_makkah.mp3
    #media_content_id: http://192.168.1.160/aud/adhan/adhan_al-aqsa.mp3
    media_content_type: audio/mp3
- delay: '00:03:50'
#- delay: '00:04:15'

# Adhan Dua
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.master_bedroom_speaker
    media_content_id: http://192.168.1.160/aud/dua/dua-e-adhan.mp3
    media_content_type: audio/mp3
- delay: '00:00:19'

#- service: media_player.volume_set
#  data:
#    entity_id:
#        - media_player.family_room_speaker
#        - media_player.guest_room_wifi
#    volume_level: '0.29'

# 96 Surah Al'Alaq
#- service: media_extractor.play_media
#  data:
#    entity_id:
#        - media_player.family_room_speaker
#        - media_player.guest_room_wifi
#    media_content_id: http://192.168.1.160/aud/surah/quran_96.mp3
#    media_content_type: audio/mp3

#- delay: '00:02:46'

# 109 Surah Al'Kafirun
#- service: media_extractor.play_media
#  data:
#    entity_id:
#        - media_player.family_room_speaker
#        - media_player.guest_room_wifi
#    media_content_id: http://192.168.1.160/aud/surah/quran_109.mp3
#    media_content_type: audio/mp3

#- delay: '00:01:19'

# 110 Surah An'Nasr
#- service: media_extractor.play_media
#  data:
#    entity_id:
#        - media_player.family_room_speaker
#        - media_player.guest_room_wifi
#    media_content_id: http://192.168.1.160/aud/surah/quran_110.mp3
#    media_content_type: audio/mp3

#- delay: '00:00:57'

# 01 Surah Al'Fatiha
- service: media_extractor.play_media
  data:
    entity_id:
      - media_player.family_room_speaker
      - media_player.guest_room_wifi
      - media_player.master_bedroom_speaker
    media_content_id: http://192.168.1.160/aud/surah/quran_01.mp3
    media_content_type: audio/mp3
- delay: '00:01:28'

# 112 Surah Al'Ikhlas
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
        - media_player.master_bedroom_speaker
    media_content_id: http://192.168.1.160/aud/surah/quran_112.mp3
    media_content_type: audio/mp3
- delay: '00:00:41'

# 113 Surah Al'Falaq
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
        - media_player.master_bedroom_speaker
    media_content_id: http://192.168.1.160/aud/surah/quran_113.mp3
    media_content_type: audio/mp3
- delay: '00:00:56'

# 114 Surah An'Nas
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
        - media_player.master_bedroom_speaker
    media_content_id: http://192.168.1.160/aud/surah/quran_114.mp3
    media_content_type: audio/mp3
- delay: '00:01:17'

# Ayat'ul Kursi
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
        - media_player.master_bedroom_speaker
    media_content_id: http://192.168.1.160/aud/ayah/ayat_ul-kursi.mp3
    media_content_type: audio/mp3

Dhuhr Adhan

################################################################################

  • alias: Dhuhr Adhan
    id: ‘1517693010923’
    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_dhuhr”), “%Y-%m-%dT%H:%M:%S”)) -3600 }}’ # Activate this in November right after the time change

value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.islamic_prayer_time_dhuhr”), “%Y-%m-%dT%H:%M:%S”)) +3600 }}’ # Activate this in March right after the time change

  value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_time_dhuhr"), "%Y-%m-%dT%H:%M:%S")) }}'       # Always the Normal

action:
- service: media_player.volume_set
data:
entity_id:
- media_player.family_room_speaker
- media_player.guest_room_wifi
volume_level: ‘0.5’

- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    #media_content_id: http://192.168.1.160/aud/adhan/adhan_makkah.mp3
    media_content_id: http://192.168.1.160/aud/adhan/adhan_al-aqsa.mp3
    media_content_type: audio/mp3
#- delay: '00:03:22'
- delay: '00:04:15'

- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/dua/dua-e-adhan.mp3
    media_content_type: audio/mp3
- delay: '00:00:19'

- service: media_extractor.play_media

data:

entity_id: media_player.family_room_speaker_2

media_content_id: http://192.168.1.160/aud/surah/quran_36.mp3

media_content_type: audio/mp3

# 01 Surah Al'Fatiha
- service: media_extractor.play_media
  data:
    entity_id:
      - media_player.family_room_speaker
      - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_01.mp3
    media_content_type: audio/mp3
- delay: '00:01:28'

# 112 Surah Al'Ikhlas
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_112.mp3
    media_content_type: audio/mp3
- delay: '00:00:41'

# 113 Surah Al'Falaq
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_113.mp3
    media_content_type: audio/mp3

- delay: '00:00:56'

# 114 Surah An'Nas
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_114.mp3
    media_content_type: audio/mp3
- delay: '00:01:17'

# Ayat'ul Kursi
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/ayah/ayat_ul-kursi.mp3
    media_content_type: audio/mp3

Asr Adhan

################################################################################

  • alias: Asr Adhan
    id: ‘1517693010924’
    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_asr”), “%Y-%m-%dT%H:%M:%S”)) -3600 }}’ # Activate this in November right after the time change

value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.islamic_prayer_time_asr”), “%Y-%m-%dT%H:%M:%S”)) +3600 }}’ # Activate this in March right after the time change

  value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_time_asr"), "%Y-%m-%dT%H:%M:%S")) }}'       # Always the Normal

action:
- service: media_player.volume_set
data:
entity_id:
- media_player.family_room_speaker
- media_player.guest_room_wifi
volume_level: ‘0.5’

- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    #media_content_id: http://192.168.1.160/aud/adhan/adhan_makkah.mp3
    media_content_id: http://192.168.1.160/aud/adhan/adhan_al-aqsa.mp3
    media_content_type: audio/mp3
#- delay: '00:03:22'
- delay: '00:04:15'

- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/dua/dua-e-adhan.mp3
    media_content_type: audio/mp3
- delay: '00:00:19'

# 01 Surah Al'Fatiha
- service: media_extractor.play_media
  data:
    entity_id:
      - media_player.family_room_speaker
      - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_01.mp3
    media_content_type: audio/mp3
- delay: '00:01:28'

# 112 Surah Al'Ikhlas
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_112.mp3
    media_content_type: audio/mp3
- delay: '00:00:41'

# 113 Surah Al'Falaq
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_113.mp3
    media_content_type: audio/mp3
- delay: '00:00:56'

# 114 Surah An'Nas
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_114.mp3
    media_content_type: audio/mp3
- delay: '00:01:17'

# Ayat'ul Kursi
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/ayah/ayat_ul-kursi.mp3
    media_content_type: audio/mp3

Maghrib Adhan

################################################################################

  • alias: Maghrib Adhan
    id: ‘1517693010925’
    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_maghrib”), “%Y-%m-%dT%H:%M:%S”)) -3600 }}’ # Activate this in November right after the time change

value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.islamic_prayer_time_maghrib”), “%Y-%m-%dT%H:%M:%S”)) +3600 }}’ # Activate this in March right after the time change

  value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_time_maghrib"), "%Y-%m-%dT%H:%M:%S")) }}'       # Always the Normal

action:
- service: media_player.volume_set
data:
entity_id:
- media_player.family_room_speaker
- media_player.guest_room_wifi
volume_level: ‘1.0’

- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    #media_content_id: http://192.168.1.160/aud/adhan/bahrain_tv_athan_akmagraib.mp3
    media_content_id: http://192.168.1.160/aud/adhan/adhan_al-maghrib_madinah.mp3
    media_content_type: audio/mp3
- delay: '00:03:37' # adhan_al-maghrib_madinah

- service: media_player.volume_set
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    volume_level: '0.5'

- service: media_extractor.play_media
  data:
    entity_id: media_player.family_room_speaker
    media_content_id: http://192.168.1.160/aud/dua/dua-e-adhan.mp3
    media_content_type: audio/mp3
- delay: '00:00:19'

# 01 Surah Al'Fatiha
- service: media_extractor.play_media
  data:
    entity_id:
      - media_player.family_room_speaker
      - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_01.mp3
    media_content_type: audio/mp3
- delay: '00:01:28'

# 112 Surah Al'Ikhlas
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_112.mp3
    media_content_type: audio/mp3
- delay: '00:00:41'

# 113 Surah Al'Falaq
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_113.mp3
    media_content_type: audio/mp3
- delay: '00:00:56'

# 114 Surah An'Nas
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_114.mp3
    media_content_type: audio/mp3

- delay: '00:01:17'

# Ayat'ul Kursi
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/ayah/ayat_ul-kursi.mp3
    media_content_type: audio/mp3

Isha Adhan

################################################################################

  • alias: Isha Adhan
    id: ‘1517693010926’
    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_isha”), “%Y-%m-%dT%H:%M:%S”)) -3600 }}’ # Activate this in November right after the time change

value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M, %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.islamic_prayer_time_isha”), “%Y-%m-%dT%H:%M:%S”)) +3600 }}’ # Activate this in March right after the time change

  value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_time_isha"), "%Y-%m-%dT%H:%M:%S")) }}'       # Always the Normal

action:
- service: media_player.volume_set
data:
entity_id:
- media_player.family_room_speaker
- media_player.guest_room_wifi
volume_level: ‘0.5’

- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    #media_content_id: http://192.168.1.160/aud/adhan/adhan_makkah.mp3
    media_content_id: http://192.168.1.160/aud/adhan/adhan_al-aqsa.mp3
    media_content_type: audio/mp3
#- delay: '00:03:22'
- delay: '00:04:15'

- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/dua/dua-e-adhan.mp3
    media_content_type: audio/mp3
- delay: '00:00:19'

# 01 Surah Al'Fatiha
- service: media_extractor.play_media
  data:
    entity_id:
      - media_player.family_room_speaker
      - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_01.mp3
    media_content_type: audio/mp3
- delay: '00:01:28'

# 112 Surah Al'Ikhlas
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_112.mp3
    media_content_type: audio/mp3
- delay: '00:00:41'

# 113 Surah Al'Falaq
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_113.mp3
    media_content_type: audio/mp3
- delay: '00:00:56'

# 114 Surah An'Nas
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/surah/quran_114.mp3
    media_content_type: audio/mp3
- delay: '00:01:17'

# Ayat'ul Kursi
- service: media_extractor.play_media
  data:
    entity_id:
        - media_player.family_room_speaker
        - media_player.guest_room_wifi
    media_content_id: http://192.168.1.160/aud/ayah/ayat_ul-kursi.mp3
    media_content_type: audio/mp3

This is what I have on my dash board: (Please ignore the lines that are appearing as heading (bolded and enlarged) as they have a # for comment in the code)

Please Help! :confused:

Hi @Edwin_D, please Sir, when you have a chance, can you help me out? :slight_smile:

Hey! I’m sharing my configuration here so you may adopt it. First of all, you have go to https://api.aladhan.com and choose whatever method you’d like to. Here I am using Hanafi method so I chose “1”. Secondly, you have to find longitude and latitude of your home address and then modify it in the link I shared here.

Paste these codes into your configuration.yaml file:

  - platform: rest
    name: "Prayer Times"
    json_attributes:
      - data
    resource: "http://api.aladhan.com/v1/timings?latitude=40.0000000&longitude=-23.00000&method=2&school=1"
    value_template: '{{ value_json["data"]["meta"]["method"]["name"].title() }}'
    scan_interval: 3600
  - platform: template
    sensors:
      fajr_prayer_time:
        friendly_name: "Fajr Prayer Time"
        value_template: >
          {{ today_at(state_attr('sensor.prayer_times','data').timings['Fajr']).strftime("%I:%M %p") }}
      dhuhr_prayer_time:
        friendly_name: "Dhuhr Prayer Time"
        value_template: >
          {{ today_at(state_attr('sensor.prayer_times','data').timings['Dhuhr']).strftime("%I:%M %p") }}
      asr_prayer_time:
        friendly_name: "Asr Prayer Time"
        value_template: >
          {{ today_at(state_attr('sensor.prayer_times','data').timings['Asr']).strftime("%I:%M %p") }}
      maghrib_prayer_time:
        friendly_name: "Maghrib Prayer Time"
        value_template: >
          {{ today_at(state_attr('sensor.prayer_times','data').timings['Maghrib']).strftime("%I:%M %p") }}
      isha_prayer_time:
        friendly_name: "Isha Prayer Time"
        value_template: >
          {{ today_at(state_attr('sensor.prayer_times','data').timings['Isha']).strftime("%I:%M %p") }}

And add these codes to automation.yaml file:

- id: '1517693010923'
  alias: Adhan
  trigger:
 - platform: template
    value_template: '{% set x = states(''sensor.fajr_prayer_time'') %} {{ now() >=
      today_at(strptime(x, "%I:%M %p").time()) }}'
  - platform: template
    value_template: '{% set x = states(''sensor.dhuhr_prayer_time'') %} {{ now() >=
      today_at(strptime(x, "%I:%M %p").time()) }}'
  - platform: template
    value_template: '{% set x = states(''sensor.asr_prayer_time'') %} {{ now() >=
      today_at(strptime(x, "%I:%M %p").time()) }}'
 - platform: template
    value_template: '{% set x = states(''sensor.isha_prayer_time'') %} {{ now() >=
      today_at(strptime(x, "%I:%M %p").time()) }}'
  - platform: template
    value_template: '{% set x = states(''sensor.isha_prayer_time'') %} {{ now() >=
      today_at(strptime(x, "%I:%M %p").time()) }}'
  condition: []
  action:
  - data:
      volume_level: 0.3
    service: media_player.volume_set
    target:
      entity_id:
      - media_player.master_bedroom_speaker
  - alias: ''
    data:
      entity_id: media_player.master_bedroom_speaker
      media_content_id: https://yourHomeAssistantIP/local/azaan.mp3
      media_content_type: music
    service: media_player.play_media

Hi @chintito4ever , Thank you for your kind help.
I removed everything from my configuration.yaml and added the above you mentioned, like so:

  - platform: rest
    name: "Prayer Times"
    json_attributes:
      - data
    resource: "http://api.aladhan.com/v1/timings?latitude=43.21824&longitude=-79.7875487&method=2&school=1"
    value_template: '{{ value_json["data"]["meta"]["method"]["name"].title() }}'
    scan_interval: 3600

  - platform: template
    sensors:
      fajr_prayer_time:
        friendly_name: "Fajr Prayer Time"
        value_template: >
          {{ today_at(state_attr('sensor.prayer_times','data').timings['Fajr']).strftime("%I:%M %p") }}
      dhuhr_prayer_time:
        friendly_name: "Dhuhr Prayer Time"
        value_template: >
          {{ today_at(state_attr('sensor.prayer_times','data').timings['Dhuhr']).strftime("%I:%M %p") }}
      asr_prayer_time:
        friendly_name: "Asr Prayer Time"
        value_template: >
          {{ today_at(state_attr('sensor.prayer_times','data').timings['Asr']).strftime("%I:%M %p") }}
      maghrib_prayer_time:
        friendly_name: "Maghrib Prayer Time"
        value_template: >
          {{ today_at(state_attr('sensor.prayer_times','data').timings['Maghrib']).strftime("%I:%M %p") }}
      isha_prayer_time:
        friendly_name: "Isha Prayer Time"
        value_template: >
          {{ today_at(state_attr('sensor.prayer_times','data').timings['Isha']).strftime("%I:%M %p") }}

I’ve updated latitude/logitude im assuming method=2 means ISNA and I have no idea about school=1.

but when I save and try to restart, I get the following error message:

Logger: homeassistant.components.hassio
Source: components/hassio/__init__.py:682 
Integration: Home Assistant Supervisor (documentation, issues) 
First occurred: 5:38:01 PM (1 occurrences) 
Last logged: 5:38:01 PM

The system cannot restart because the configuration is not valid: Error loading /config/configuration.yaml: The configuration file configuration.yaml does not contain a dictionary

What am I missing?