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

To what version have you rolled back plz.

Salam alikom, did anybody figure out a way to add a countdown to the next prayer?

I would like to have this too

The sensor’s time format changed over a year ago and for a good reason. Its format is compatible for use with a Time Trigger (no template is needed). I explained this in July 2021 and posted an example:

With this new format, what if we wanted to set up 10 minute reminders/alarms. Would we be able to do

sensor.fajr_prayer - 600

Or is there a different way to do it?

Currently, the Time Trigger doesn’t support an offset value so you must use a Template Trigger.

Here’s an example of a Template Trigger that triggers 10 minutes (600 seconds) before any of the five prayer times.

trigger:
  - platform: template
    value_template: >
      {{ now().timestamp() | int(0) + 600 in expand('sensor.fajr_prayer', 'sensor.dhuhr_prayer', 
        'sensor.asr_prayer', 'sensor.isha_prayer', 'sensor.maghrib_prayer')
        | map(attribute='state') | map('as_timestamp') | list }}

Looks like the prayer times API is down. After the 1AM restart, it’s showing all athan sensors unavailable. And Prayer Times integration is showing an error fetching a response from the API. Anyone else getting this?

@123 . Thank you brother for your assistance in this thread. I would be grateful if you can repost the revised process to automate adthan and make it sticky because this thread is long and a lot of information that confuse the newbies like me. Thank you again.

Something like this would be very helpful to glance at wall dashboards. maybe using mushroom cards.
something like from praywatch app on IOS
image

Guys , can someone post the updated Configuration Files along with the Automation files that worked ?

I can manually trigger the automation and the AZAN works, but its not being triggered by any sensors. Also the Groups.yaml is missing in the installation

My Configuration File

homeassistant:
  latitude: -37.840935
  longitude: 144.946457
  unit_system: metric
  time_zone: Australia/Melbourne
  
default_config:
discovery:
media_extractor:
sun:

# Islamic prayer times integration
islamic_prayer_times:
    calculation_method: karachi

# 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 }}

# Text to speech
tts:
  - platform: google_translate

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

MY Automation File

- id: '1517693010922'
  alias: Adhan
  trigger:
  - 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: ''
    data:
      entity_id: media_player.living_room_speaker
      media_content_id: http://www.shianeali.com/dua/Azan/1%20-%20Abathar%20Al%20Halawaji%20-%20Azan%20(Call%20For%20Prayer).mp3
      media_content_type: audio/mp3
    service: media_extractor.play_media
  - data:
      volume_level: 0.4
    service: media_player.volume_set
    target:
      entity_id: media_player.living_room_speaker
  mode: single
- id: '1517693034922'
  alias: Fajar Azaan
  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"))
      }}'
  condition: []
  action:
  - alias: Fajar
    data:
      entity_id: media_player.living_room_speaker
      media_content_id: https://www.islamcan.com/audio/adhan/azan3.mp3
      media_content_type: audio/mp3
    service: media_extractor.play_media
  - data:
      volume_level: 0.4
    service: media_player.volume_set
    target:
      area_id: living_room
      device_id: 83982c1f80fda986dd93cfbee8f335d7
      entity_id: media_player.living_room_speaker
  mode: single
- alias: Restart HA
  trigger:
    platform: time
    at: 02:00:00
  action:
  - service: homeassistant.restart```

Salam aalikom @snaqvi. You have all configuration. You can add now the Islamic prayer time integration from Home assistant. Go to settings<devices and services<add integration and search for islamic prayers time. or you can add it through this link. I have an automation for the adthan for alexa devices. If you need my code, I will be happy to share it here.

When my Home assistant is updated i dont get to see the times on the Glance Card it says Unknown. Where can i look to solve the problem?

Same issue over here. I am scraping the times of a website but see it also as ‘‘unknown’’ instead of the time. This is my config:

Date & Time

  • platform: time_date
    display_options:
    • ‘time’
  • platform: scrape
    resource: Diyanet İşleri Başkanlığı | Papendrecht İçin Namaz Vakti
    select: “#today-pray-times-row > div:nth-child(1) > div > div.tpt-time”
    name: İmsak
  • platform: scrape
    resource: Diyanet İşleri Başkanlığı | Papendrecht İçin Namaz Vakti
    name: Güneş
    select: “#today-pray-times-row > div:nth-child(2) > div > div.tpt-time”
  • platform: scrape
    resource: Diyanet İşleri Başkanlığı | Papendrecht İçin Namaz Vakti
    name: Öğle
    select: “#today-pray-times-row > div:nth-child(3) > div > div.tpt-time”
  • platform: scrape
    resource: Diyanet İşleri Başkanlığı | Papendrecht İçin Namaz Vakti
    name: İkindi
    select: “#today-pray-times-row > div:nth-child(4) > div > div.tpt-time”
  • platform: scrape
    resource: Diyanet İşleri Başkanlığı | Papendrecht İçin Namaz Vakti
    name: Akşam
    select: “#today-pray-times-row > div:nth-child(5) > div > div.tpt-time”
  • platform: scrape
    resource: Diyanet İşleri Başkanlığı | Papendrecht İçin Namaz Vakti
    name: Yatsı
    select: “#today-pray-times-row > div:nth-child(6) > div > div.tpt-time”
  • platform: template
    sensors:
    imsak_vakti:
    friendly_name: “İmsak Vakti”
    value_template: “{{ states(‘sensor.aksam’) == states(‘sensor.time’) }}”
  • platform: template
    sensors:
    gunes_vakti:
    friendly_name: “Güneş Vakti”
    value_template: “{{ states(‘sensor.gunes’) == states(‘sensor.time’) }}”
  • platform: template
    sensors:
    ogle_namazi:
    friendly_name: “Öğle Vakti”
    value_template: “{{ states(‘sensor.ogle’) == states(‘sensor.time’) }}”
  • platform: template
    sensors:
    ikindi_namazi:
    friendly_name: “İkindi Vakti”
    value_template: “{{ states(‘sensor.ikindi’) == states(‘sensor.time’) }}”
  • platform: template
    sensors:
    aksam_namazi:
    friendly_name: “Akşam Vakti”
    value_template: “{{ states(‘sensor.aksam’) == states(‘sensor.time’) }}”
  • platform: template
    sensors:
    yatsi_namazi:
    friendly_name: “Yatsı Vakti”
    value_template: “{{ states(‘sensor.yatsi’) == states(‘sensor.time’) }}”

I am not familiar with the time settings you have. Mine works just fine . I am using the new setup though. . I added the islamic prayers time integration and then configure according the time I want. Then made my automation .You may want to add the islamic prayers time integration by adding it from the settings and add integration. You can read more about here

High can someone point out how Diyanet can be implemented ?? I did webscrap but did work for while… it states unknown now…

MAY Allah blesses you all

Salam Alikom. what’s the new setup everyone is talking about?

Waalikom assalam. I just configured the adthan using Home assistant. I added the islamic prayers times integration from the settings. Then I created the automation to call adthan on my alexa devices. No need to add anything in the configuration file like adding your latitude or longitude…

I am not familiar with Diyanet nor the webscrap but if you need to configure the athan through HA, you can add the islamic prayers time integration from the home assistant settings. There is also a blueprint of the automation if you would like to add it to alexa.

Thanks i solve the problem about webscrape. I also look in to azhan app. But couldn’t find diyanet calculation…

After adding the islamic prayers times, you should see it in your integration:
Capture
After that if you click on configure, you should see a pop window like the following
2
You will be to configure the adthan times according to they calculation system you like.