Adhan Automation (الأذان التلقائي للصلاة) using google speaker

Thanks for the response @chintito4ever. I am not anything when clicked the trace. Is that any other place i need to look at?

I am able to enable the tracing after restart of HA instance. Now by manually triggering the automation for Fajr and All four Adan, Trace is available. PFB.

However, I am still seeing the sensor times are incorrect for the Toronto, Canada location. Do you see any issues below?

Dear brothers,
The automation is working for me now. I have updated my automations.yaml file as follows.

# Automation for 4 times Azan
- action:
    - alias: "FourAdhan"
      data:
        entity_id: media_player.nestmini8653
        media_content_id: http://local:8123/local/adhan/all-adhan-mishary.mp3
        media_content_type: audio/mp3
      service: media_extractor.play_media
    - data:
        entity_id: media_player.nestmini8653
        volume_level: "0.8"
      service: media_player.volume_set
  alias: Four_Adhan
  condition: []
  id: "1517694139312"
  trigger:
    - platform: template
      value_template: '{{ now().timestamp()|int == as_timestamp(states("sensor.dhuhr_prayer")) }}'
    - platform: template
      value_template: '{{ now().timestamp()|int == as_timestamp(states("sensor.asr_prayer")) }}'
    - platform: template
      value_template: '{{ now().timestamp()|int == as_timestamp(states("sensor.maghrib_prayer")) }}'
    - platform: template
      value_template: '{{ now().timestamp()|int == as_timestamp(states("sensor.isha_prayer")) }}'

Based on the logs and suggestion from following threads, I am able to resolve it. Islamic Prayer Times issue with the sensor integration after Core update - does not support platform setup · Issue #73201 · home-assistant/core · GitHub
Offset time - #37 by om3r

Salaam Brothers,

I have the automation working perfectly minus one small thing. The Islamic Prayer Time integration doesn’t have a calculation for the UK, the closest is MWL but it isn’t correct. Is there a way I can correct this without having to change anything constantly.

Thanks

Salaam everyone,

can someone help me do azan automation but play via alexa

prayer time: London

Thanks

@Nameless900 , you may want to check this post

It’s been described here

Can you help me with configuration and automation with diyanet Netherlands files?

Can you please put more clarification about what you need?

are you using my addo? if yes there is a description how to configure that

I’ve been trying to get your addon to work but I’m getting unknown when I remove == states(‘sensor.time’) and always false if I dont.

If I run http://localhost:1453/api/dailyPrayerTimes/11421 I get correct results

{"regionId":11421,"region":"Melbourne","prayerTimes":[{"date":"23.03.2023","fajr":"05:58","sun":"07:18","dhuhur":"13:32","asr":"16:56","maghrib":"19:36","isha":"20:51"},{"date":"24.03.2023","fajr":"05:59","sun":"07:19","dhuhur":"13:32","asr":"16:55","maghrib":"19:34","isha":"20:49"}]}

This is what I have added in my configuration.yaml

  - platform: rest
    name: namaz_vakti
    resource: "http://localhost:1453/api/dailyPrayerTimes/11421"
    scan_interval: 25200
    json_attributes_path: $.prayerTimes[0]
    json_attributes:
      - date
      - fajr
      - sun
      - dhuhur
      - asr
      - maghrib
      - isha
    value_template: >
      {% set now = now() %}
      {% set fajr = today_at(state_attr('sensor.namaz_vakti', 'fajr')) %}
      {% set sun = today_at(state_attr('sensor.namaz_vakti', 'sun')) %}
      {% set dhuhur = today_at(state_attr('sensor.namaz_vakti', 'dhuhur')) %}
      {% set asr = today_at(state_attr('sensor.namaz_vakti', 'asr')) %}
      {% set maghrib = today_at(state_attr('sensor.namaz_vakti', 'maghrib')) %}
      {% set isha = today_at(state_attr('sensor.namaz_vakti', 'isha')) %}
      {% if now < fajr %}
        Imsak: {{ state_attr('sensor.namaz_vakti', 'fajr') }}
      {% elif now < sun %}
        Gunes: {{ state_attr('sensor.namaz_vakti', 'sun') }}
      {% elif now < dhuhur %}
        Oglen: {{ state_attr('sensor.namaz_vakti', 'dhuhur') }}
      {% elif now < asr %}
        Ikindi: {{ state_attr('sensor.namaz_vakti', 'asr') }}
      {% elif now < maghrib %}
        Aksam: {{ state_attr('sensor.namaz_vakti', 'maghrib') }}
      {% elif now < isha %}
        Yatsi: {{ state_attr('sensor.namaz_vakti', 'isha') }}
      {% else %}
        unknown
      {% endif %}
      
  - platform: template
    sensors:
      diyanet_imsak_vakti:
        friendly_name: "Imsak Vakti"
        value_template: "{{state_attr('sensor.namaz_vakti', 'fajr') }}"
      diyanet_gunes_vakti:
        friendly_name: "Gunes Vakti"
        value_template: "{{state_attr('sensor.namaz_vakti', 'sun') }}"
      diyanet_ogle_namazi:
        friendly_name: "Ogle Vakti"
        value_template: "{{state_attr('sensor.namaz_vakti', 'dhuhur') }}"
      diyanet_ikindi_namazi:
        friendly_name: "Ikindi Vakti"
        value_template: "{{state_attr('sensor.namaz_vakti', 'asr') }}"
      diyanet_aksam_namazi:
        friendly_name: "Aksam Vakti"
        value_template: "{{state_attr('sensor.namaz_vakti', 'maghrib') }}"
      diyanet_yatsi_namazi:
        friendly_name: "Yatsi Vakti"
        value_template: "{{state_attr('sensor.namaz_vakti', 'isha') }}"

  - platform: template
    sensors:
      imsak_notify:
        friendly_name: "İmsak Vakti Notify"
        value_template: "{{state_attr('sensor.namaz_vakti', 'fajr') == states('sensor.time')}}"
      gunes_notify:
        friendly_name: "Güneş Vakti Notify"
        value_template: "{{state_attr('sensor.namaz_vakti', 'sun') == states('sensor.time')}}"
      ogle_notify:
        friendly_name: "Öğle Vakti Notify"
        value_template: "{{state_attr('sensor.namaz_vakti', 'dhuhur') == states('sensor.time')}}"
      ikindi_notify:
        friendly_name: "İkindi Vakti Notify"
        value_template: "{{state_attr('sensor.namaz_vakti', 'asr') == states('sensor.time')}}"
      aksam_notify:
        friendly_name: "Akşam Vakti Notify"
        value_template: "{{state_attr('sensor.namaz_vakti', 'maghrib') == states('sensor.time')}}"
      yatsi_notify:
        friendly_name: "Yatsı Vakti Notify"
        value_template: "{{state_attr('sensor.namaz_vakti', 'isha') == states('sensor.time')}}"

Hi Sahar,

I have been to setup the Adan integrations for a few days with little success, I can trigger adan manually if I run the script but the automation piece does not work - below are my config and automation files, if you coud kindly assist please -

Config File -
/
homeassistant:
latitude: 43.526646
longitude: -79.891205
elevation: 217
unit_system: metric
time_zone: America/Toronto

discovery:
media_extractor:
sun:

Islamic prayer times integration

islamic_prayer_times:
calculation_method: mwl

Sensors

sensor:

  • platform: time_date
    display_options:
    • ‘time’
    • ‘date’
    • ‘time_date’
  • platform: template
    sensors:
    salah_fajr:
    friendly_name: “Salah Fajr”
    value_template: >
    {%- set a = states(“sensor.fajr_prayer”).split(“T”)[1].split(":")[0] -%}
    {%- set b = states(“sensor.fajr_prayer”).split(“T”)[1].split(":")[1] -%}
    {{ a + “:” + b }}
    salah_dhuhr:
    friendly_name: “Salah Dhuhr”
    value_template: >
    {%- set a = states(“sensor.dhuhr_prayer”).split(“T”)[1].split(":")[0] -%}
    {%- set b = states(“sensor.dhuhr_prayer”).split(“T”)[1].split(":")[1] -%}
    {{ a + “:” + b }}
    salah_asr:
    friendly_name: “Salah Asr”
    value_template: >
    {%- set a = states(“sensor.asr_prayer”).split(“T”)[1].split(":")[0] -%}
    {%- set b = states(“sensor.asr_prayer”).split(“T”)[1].split(":")[1] -%}
    {{ a + “:” + b }}
    salah_maghrib:
    friendly_name: “Salah Maghrib”
    value_template: >
    {%- set a = states(“sensor.maghrib_prayer”).split(“T”)[1].split(":")[0] -%}
    {%- set b = states(“sensor.maghrib_prayer”).split(“T”)[1].split(":")[1] -%}
    {{ a + “:” + b }}
    salah_isha:
    friendly_name: “Salah Isha”
    value_template: >
    {%- set a = states(“sensor.isha_prayer”).split(“T”)[1].split(":")[0] -%}
    {%- set b = states(“sensor.isha_prayer”).split(“T”)[1].split(":")[1] -%}
    {{ a + “:” + b }}
    automation: !include automations.yaml
    script: !include scripts.yaml
    scene: !include scenes.yaml
    /

my Automation File -

/
id: ‘1679835844405’
alias: Adhan
description: ‘’
trigger:

  • platform: template
    value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M,
    %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.fajr_prayer”), “%Y-%m-%dT%H:%M:%S”))
    }}’
  • platform: template
    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”))
    }}’
  • platform: template
    value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M,
    %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.asr_prayer”), “%Y-%m-%dT%H:%M:%S”))
    }}’
  • platform: template
    value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M,
    %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.maghrib_prayer”), “%Y-%m-%dT%H:%M:%S”))
    }}’
  • platform: template
    value_template: ‘{{ as_timestamp(strptime(states(“sensor.time_date”), “%H:%M,
    %Y-%m-%d”)) == as_timestamp(strptime(states(“sensor.isha_prayer”), “%Y-%m-%dT%H:%M:%S”))
    }}’
    condition: []
    action:
  • alias: Azan
    data:
    entity_id: media_player.all_g_display
    media_content_id: http://192.168.86.68:8123/local/AthanByYusufIslam.mp3
    media_content_type: audio/mp3
    service: media_extractor.play_media
  • data:
    entity_id: media_player.all_g_display
    volume_level: ‘0.6’
    service: media_player.volume_set
    mode: single
  • alias: Restart HA
    trigger:
    platform: time
    at: 01:00:00
    action:
    • service: homeassistant.restart
      id: 6145b39c17954cc0a47b4e22e51193cb
  • id: ‘1679837642811’
    alias: Restart HA
    description: ‘’
    trigger:
    • platform: time
      at: 01:00:00
      condition: []
      action:
    • service: homeassistant.restart
      data: {}
      mode: single
      /sensors
      I live in Milton, Ontario , Canada - please see attachd picture for sensor status it shows unavailable all across.

I got this automation but its not triggering:

  • id: ‘1676133222550’
    alias: 1 Ezan Sabah
    trigger:
    • platform: state
      entity_id:
      • sensor.namaz_vakti
        to: ‘True’
        attribute: asr
        condition: []
        action:
    • service: media_player.play_media
      data:
      media_content_id: media-source://media_source/local/Azan.mp3
      media_content_type: audio/mp3
      target:
      entity_id: media_player.keuken_display
    • service: media_player.volume_set
      data:
      volume_level: 0.4
      target:
      entity_id: media_player.keuken_display
      mode: single

hi may i know where can i get the “ID” from?

The value of the automation’s id option can be whatever you want, as long as it’s different from any other automation.

Did you have found any solution? I am looking a solution to see on an separate sensor the next Prayer TIme.

i have now problem with fetching data and i think something breaks now with REST api. The sensors says unknown now. By me nothing was changed. What can be the problem?

@Himdola Still working fine for me.
@starnetworks FYI also interesting for you

See Diyanet Ezan in Home Assistant which I updated to reflect the latest changes.

For the next prayer sensor:

- platform: template

    sensors:

      next_prayer:

        friendly_name: Next Prayer

        value_template: >-

          {% set state = states('sensor.time') %} {% if '00:00' <= state <

          states('sensor.imsak') %} {{ states('sensor.imsak') }}  {% elif

          states('sensor.imsak') <= state < states('sensor.gunes') %} {{

          states('sensor.gunes') }}  {% elif states('sensor.gunes') <= state <

          states('sensor.ogle') %} {{ states('sensor.ogle') }}  {% elif

          states('sensor.ogle') <= state < states('sensor.ikindi') %} {{

          states('sensor.ikindi') }}  {% elif states('sensor.ikindi') <= state <

          states('sensor.aksam') %} {{ states('sensor.aksam') }}  {% elif

          states('sensor.aksam') <= state < states('sensor.yatsi') %} {{

          states('sensor.yatsi') }}  {% elif states('sensor.yatsi') <= state <

          '23:59' %} {{ states('sensor.imsak') }}  {% endif %}

Hi Salih, the code only generates eg. sensor.imsak but not sensor.imsak.vakti
Am I missing something?
@Salerg

rest:
  method: GET
  scan_interval: 172800
  resource: "https://ezanvakti.herokuapp.com/vakitler/11421"
  sensor:
    - name: Imsak
      value_template: >-
        {% for entry in value_json %} {% if entry.MiladiTarihKisa ==
        now().strftime('%d.%m.%Y') %} {{ entry.Imsak }} {% endif %} {% endfor %}
    - name: Ogle
      value_template: >-
        {% for entry in value_json %} {% if entry.MiladiTarihKisa ==
        now().strftime('%d.%m.%Y') %} {{ entry.Ogle }} {% endif %} {% endfor %}
    - name: Ikindi
      value_template: >-
        {% for entry in value_json %} {% if entry.MiladiTarihKisa ==
        now().strftime('%d.%m.%Y') %} {{ entry.Ikindi }} {% endif %} {% endfor
        %}
    - name: Aksam
      value_template: >-
        {% for entry in value_json %} {% if entry.MiladiTarihKisa ==
        now().strftime('%d.%m.%Y') %} {{ entry.Aksam }} {% endif %} {% endfor %}
    - name: Yatsi
      value_template: >-
        {% for entry in value_json %} {% if entry.MiladiTarihKisa ==
        now().strftime('%d.%m.%Y') %} {{ entry.Yatsi }} {% endif %} {% endfor %}
    - name: hicri
      value_template: >-
        {% for entry in value_json %} {% if entry.MiladiTarihKisa ==
        now().strftime('%d.%m.%Y') %} {{ entry.HicriTarihUzun }} {% endif %} {%
        endfor %}
    - name: Gunes
      value_template: >-
        {% for entry in value_json %} {% if entry.MiladiTarihKisa ==
        now().strftime('%d.%m.%Y') %} {{ entry.Gunes }} {% endif %} {% endfor %}

@Salerg also it does not create

entity: input_boolean.disableprayer