100% Accurate Athan (Azan Adhan Azaan أذان) as a senor

Salam Alikom Brothers,

I have been struggling with the integration for Athan, it is not accurate I wanted to share my solution on how I have captured the data for our official source for the timing in Dubai.

Our official source is IACAD website

I have used the scrape integration that comes preinstalled with Home Assistant

You need to have internet access to the HA instant. Below you can find the code for the senor,

sensor:
  - platform: scrape
    resource: https://services.iacad.gov.ae/SmartPortal/en/Timings
    name: Fajr Time
    select: "td"
    index: 1
    value_template: '{{ value.split("AM")[0] }}'
    unit_of_measurement: hours

  - platform: scrape
    resource: https://services.iacad.gov.ae/SmartPortal/en/Timings
    name: Dohr Time
    select: "td"
    index: 7
    value_template: '{{ value.split("PM")[0] }}'
    unit_of_measurement: hours

  - platform: scrape
    resource: https://services.iacad.gov.ae/SmartPortal/en/Timings
    name: Asr Time
    select: "td"
    index: 10
    value_template: '{{ value.split("PM")[0] }}'
    unit_of_measurement: hours

  - platform: scrape
    resource: https://services.iacad.gov.ae/SmartPortal/en/Timings
    name: Magrib Time
    select: "td"
    index: 13
    value_template: '{{ value.split("PM")[0] }}'
    unit_of_measurement: hours

  - platform: scrape
    resource: https://services.iacad.gov.ae/SmartPortal/en/Timings
    name: Isha Time
    select: "td"
    index: 16
    value_template: '{{ value.split("PM")[0] }}'
    unit_of_measurement: hours

##### the below sensors is used for automation purpose #####

  - platform: template
      fajr_24:
        friendly_name: 'Fajr 24 Format'
        icon_template: "mdi:clock"
        value_template: >
          {% set fajr_time_in_12_fromat = as_timestamp(states.sensor.date.state + ' ' + states.sensor.Fajr_time.state) %}
          {{fajr_time_in_12_fromat|timestamp_local}}

      dohr_24:
        friendly_name: 'Dohr 24 Format'
        icon_template: "mdi:clock"
        value_template: >
          {%- set dohr_time_in_12_fromat = as_timestamp(states.sensor.date.state + ' ' + states.sensor.dohr_time.state) %}
          {{dohr_time_in_12_fromat|timestamp_local}}

      asr_24:
        friendly_name: 'Asr 24 Format'
        icon_template: "mdi:clock"
        value_template: >
          {%- set asr_time_in_12_fromat = as_timestamp(states.sensor.date.state + ' ' + states.sensor.asr_time.state) %}
          {%- set asr_time_in_24_fromat = asr_time_in_12_fromat | int + 43200 %}
          {{asr_time_in_24_fromat|timestamp_local}}

      magrib_24:
        friendly_name: 'Magrib 24 Format'
        icon_template: "mdi:clock"
        value_template: >
          {%- set magrib_time_in_12_fromat = as_timestamp(states.sensor.date.state + ' ' + states.sensor.magrib_time.state) %}
          {%- set magrib_time_in_24_fromat = magrib_time_in_12_fromat | int + 43200 %}
          {{magrib_time_in_24_fromat|timestamp_local}}

      isha_24:
        friendly_name: 'Isha 24 Format'
        icon_template: "mdi:clock"
        value_template: >
          {%- set isha_time_in_12_fromat = as_timestamp(states.sensor.date.state + ' ' + states.sensor.isha_time.state) %}
          {%- set isha_time_in_24_fromat = isha_time_in_12_fromat | int + 43200 %}
          {{isha_time_in_24_fromat|timestamp_local}}

      test_24:
        friendly_name: 'Isha 24 Format'
        icon_template: "mdi:clock"
        value_template: >
          {%- set test = "21:56" %}
          {%- set test_24 = as_timestamp(states.sensor.date.state + ' ' + test) %}
          {{test_24|timestamp_local}}

This will generate sensors only, now you need to do the automations as per your needs, there are samples here in the community:

Adhan automation (أذان التلقائي) using Home Assistant and Google Home Mini

Automate Islamic Adhan (also called Azan or Azzan) or other prayer calls

Azaan/Adhan/Azan on your Alexa devices

To use it as time trigger, choose in the triggers section: Trigger type as template, add ID if you need then the Value template is as below:

{{ as_timestamp(states('sensor.asr_24'))|timestamp_custom('%H:%M', true) == states('sensor.time')  }}

This is only for 1 example you need to change the sensor for each automation.

Salam Alikom :smiley: