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

i added the below in my config

 sensor:
   - platform: time_date
     display_options:
       - 'time'
       - 'date'
       - 'date_time'
       - 'date_time_utc'
       - 'date_time_iso'
       - 'time_date'
       - 'time_utc'
       - 'beat'
  - platform: islamic_prayer_times
    calculation_method: isna
    sensors:
      - fajr
      - dhuhr
      - asr
      - maghrib
      - isha

Still the same issue persists

You don’t seem to have the ‘- midnight’ sensor listed? You should have this too.

Assalamualaikum brothers, I’m in Singapore and using karachi as the calculation method. I notice that Fajr is always 8 minutes late and Dhuhr is always 1 minute late, how can i adjust it?

Karachi is the best with just this two slightly off, other methods result in more timing error.

Jazakallah Kheir to all for their wonderfull work with the automation of the athan.

I have set the automation to run on a number of Google home mini and google displays.

My question is, isnt the audio suppose to be synced between them all? I mean when the athan starts which is running as an mp3 file from the www there is a nano sec delay between the devices so the are out of syncs its like when you hear athan back home where you can hear one masjid and less then a sec you hear other masjid, rather then all speakers being in sync. Something I am doing wrong?

What automation file are you using? Please share your automation.yaml file.

Currently I’m just using Entity card to HA dashboard with the following config:

sensor:
        
  - platform: islamic_prayer_times
    calculation_method: karachi
    sensors:
      - fajr
      - sunrise
      - dhuhr
      - asr
      - maghrib
      - isha
      - midnight
      
  - platform: template
    sensors:
      salah_fajr:
        friendly_name: "Subuh"
        value_template: '{{ (states("sensor.islamic_prayer_time_fajr").split("T")[1].split(":")[0]) +":"+ (states("sensor.islamic_prayer_time_fajr").split("T")[1].split(":")[1])}}'

      salah_dhuhr:
        friendly_name: "Zohor"
        value_template: '{{ (states("sensor.islamic_prayer_time_dhuhr").split("T")[1].split(":")[0]) +":"+ (states("sensor.islamic_prayer_time_dhuhr").split("T")[1].split(":")[1])}}'

          
      salah_asr:
        friendly_name: "Asar"
        value_template: '{{ (states("sensor.islamic_prayer_time_asr").split("T")[1].split(":")[0]) +":"+ (states("sensor.islamic_prayer_time_asr").split("T")[1].split(":")[1]) }}'

      salah_maghrib:
        friendly_name: "Maghrib"
        value_template: '{{ (states("sensor.islamic_prayer_time_maghrib").split("T")[1].split(":")[0]) +":"+ (states("sensor.islamic_prayer_time_maghrib").split("T")[1].split(":")[1]) }}'

      salah_isha:
        friendly_name: "Isyak"
        value_template: '{{ (states("sensor.islamic_prayer_time_isha").split("T")[1].split(":")[0]) +":"+ (states("sensor.islamic_prayer_time_isha").split("T")[1].split(":")[1]) }}'

      salah_actual:
        friendly_name: "Salah Actual"
        value_template: "{%- if is_state('sensor.salah_fajr', states('sensor.time')) -%}
             Fajr
           {%- elif is_state('sensor.salah_dhuhr', states('sensor.time')) -%}
             Dhuhr
           {%- elif is_state('sensor.salah_asr', states('sensor.time')) -%}
             Asr
           {%- elif is_state('sensor.salah_maghrib', states('sensor.time')) -%}
             Maghrib
           {%- elif is_state('sensor.salah_isha', states('sensor.time')) -%}
             Isha
           {%- endif -%}"

Fajr is 8 min late, while Dhuhr is 1 minute early.
On HA:

Screenshot 2020-04-12 at 10.09.53 PM

Actual Salah timing in Singapore:

Assalamu Alaikum, I am trying to also get the Adhan to play from my google nest hub. I am trying to install home assistant on windows 10 OS. But not having luck as of yet.
I’m a complete noob to computing and IT, so please bare with me- Jazzakallah

Steps made:
I downloaded python- latest version/release for windows that they have on their site.
I downloaded the visual effects building tools required as I was getting an error message when trying to install home assistant on Command Prompt.
Now when I try to run the home assistant programme- it shows this-see below? Can or does anyone know what I’m doing wrong or missing.

Sorry if turns out to be something silly :disappointed_relieved:

C:\Users\Student>hass
2020-04-13 14:00:03 INFO (MainThread) [homeassistant.bootstrap] Config directory: C:\Users\Student\AppData\Roaming\.homeassistant
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded homeassistant from homeassistant.components.homeassistant
2020-04-13 14:00:03 INFO (SyncWorker_1) [homeassistant.loader] Loaded persistent_notification from homeassistant.components.persistent_notification
2020-04-13 14:00:03 INFO (MainThread) [homeassistant.setup] Setting up homeassistant
2020-04-13 14:00:03 INFO (MainThread) [homeassistant.setup] Setup of domain homeassistant took 0.0 seconds.
2020-04-13 14:00:03 INFO (MainThread) [homeassistant.setup] Setting up persistent_notification
2020-04-13 14:00:03 INFO (MainThread) [homeassistant.setup] Setup of domain persistent_notification took 0.0 seconds.
2020-04-13 14:00:03 INFO (SyncWorker_1) [homeassistant.loader] Loaded script from homeassistant.components.script
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded default_config from homeassistant.components.default_config
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded group from homeassistant.components.group
2020-04-13 14:00:03 INFO (SyncWorker_1) [homeassistant.loader] Loaded scene from homeassistant.components.scene
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded automation from homeassistant.components.automation
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded tts from homeassistant.components.tts
2020-04-13 14:00:03 INFO (SyncWorker_3) [homeassistant.loader] Loaded cloud from homeassistant.components.cloud
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded http from homeassistant.components.http
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded webhook from homeassistant.components.webhook
2020-04-13 14:00:03 INFO (SyncWorker_3) [homeassistant.loader] Loaded alexa from homeassistant.components.alexa
2020-04-13 14:00:03 INFO (SyncWorker_1) [homeassistant.loader] Loaded config from homeassistant.components.config
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded frontend from homeassistant.components.frontend
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded api from homeassistant.components.api
2020-04-13 14:00:03 INFO (SyncWorker_3) [homeassistant.loader] Loaded auth from homeassistant.components.auth
2020-04-13 14:00:03 INFO (SyncWorker_1) [homeassistant.loader] Loaded device_automation from homeassistant.components.device_automation
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded lovelace from homeassistant.components.lovelace
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded onboarding from homeassistant.components.onboarding
2020-04-13 14:00:03 INFO (SyncWorker_1) [homeassistant.loader] Loaded person from homeassistant.components.person
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded search from homeassistant.components.search
2020-04-13 14:00:03 INFO (SyncWorker_3) [homeassistant.loader] Loaded websocket_api from homeassistant.components.websocket_api
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded system_log from homeassistant.components.system_log
2020-04-13 14:00:03 INFO (SyncWorker_1) [homeassistant.loader] Loaded history from homeassistant.components.history
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded recorder from homeassistant.components.recorder
2020-04-13 14:00:03 INFO (SyncWorker_3) [homeassistant.loader] Loaded logbook from homeassistant.components.logbook
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded map from homeassistant.components.map
2020-04-13 14:00:03 INFO (SyncWorker_1) [homeassistant.loader] Loaded mobile_app from homeassistant.components.mobile_app
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded ssdp from homeassistant.components.ssdp
2020-04-13 14:00:03 INFO (SyncWorker_3) [homeassistant.loader] Loaded sun from homeassistant.components.sun
2020-04-13 14:00:03 INFO (SyncWorker_3) [homeassistant.loader] Loaded system_health from homeassistant.components.system_health
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded updater from homeassistant.components.updater
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded zeroconf from homeassistant.components.zeroconf
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded zone from homeassistant.components.zone
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded input_boolean from homeassistant.components.input_boolean
2020-04-13 14:00:03 INFO (SyncWorker_1) [homeassistant.loader] Loaded input_datetime from homeassistant.components.input_datetime
2020-04-13 14:00:03 INFO (SyncWorker_3) [homeassistant.loader] Loaded input_text from homeassistant.components.input_text
2020-04-13 14:00:03 INFO (SyncWorker_2) [homeassistant.loader] Loaded input_number from homeassistant.components.input_number
2020-04-13 14:00:03 INFO (SyncWorker_0) [homeassistant.loader] Loaded input_select from homeassistant.components.input_select
2020-04-13 14:00:03 INFO (MainThread) [homeassistant.bootstrap] Setting up {'system_log'}
2020-04-13 14:00:03 INFO (MainThread) [homeassistant.setup] Setting up http
2020-04-13 14:00:03 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.0 seconds.
2020-04-13 14:00:03 INFO (MainThread) [homeassistant.setup] Setting up system_log
2020-04-13 14:00:03 INFO (MainThread) [homeassistant.setup] Setup of domain system_log took 0.0 seconds.
2020-04-13 14:00:04 INFO (MainThread) [homeassistant.setup] Setting up recorder
2020-04-13 14:00:04 INFO (MainThread) [homeassistant.setup] Setting up webhook
2020-04-13 14:00:04 INFO (MainThread) [homeassistant.setup] Setup of domain webhook took 0.0 seconds.
2020-04-13 14:00:04 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=19 from 2020-04-13 12:44:31.385546)
2020-04-13 14:00:05 INFO (MainThread) [homeassistant.setup] Setting up alexa
2020-04-13 14:00:05 INFO (MainThread) [homeassistant.setup] Setup of domain alexa took 0.0 seconds.
2020-04-13 14:00:05 INFO (MainThread) [homeassistant.setup] Setup of domain recorder took 0.8 seconds.
2020-04-13 14:00:05 INFO (SyncWorker_3) [homeassistant.loader] Loaded google_assistant from homeassistant.components.google_assistant
2020-04-13 14:00:05 INFO (SyncWorker_2) [homeassistant.loader] Loaded camera from homeassistant.components.camera
2020-04-13 14:00:05 INFO (SyncWorker_0) [homeassistant.loader] Loaded homekit from homeassistant.components.homekit
2020-04-13 14:00:05 INFO (SyncWorker_3) [homeassistant.loader] Loaded device_tracker from homeassistant.components.device_tracker
2020-04-13 14:00:05 INFO (SyncWorker_2) [homeassistant.loader] Loaded media_player from homeassistant.components.media_player
2020-04-13 14:00:08 INFO (MainThread) [homeassistant.setup] Setting up cloud
2020-04-13 14:00:08 INFO (MainThread) [homeassistant.setup] Setup of domain cloud took 0.1 seconds.
2020-04-13 14:00:08 INFO (MainThread) [homeassistant.setup] Setting up scene
2020-04-13 14:00:08 INFO (MainThread) [homeassistant.components.scene] Setting up scene.homeassistant
2020-04-13 14:00:08 INFO (MainThread) [homeassistant.setup] Setting up input_select
2020-04-13 14:00:08 INFO (MainThread) [homeassistant.setup] Setting up ssdp
2020-04-13 14:00:08 INFO (MainThread) [homeassistant.setup] Setup of domain ssdp took 0.0 seconds.
2020-04-13 14:00:08 INFO (MainThread) [homeassistant.setup] Setting up input_boolean
2020-04-13 14:00:08 INFO (MainThread) [homeassistant.setup] Setting up updater
2020-04-13 14:00:08 INFO (MainThread) [homeassistant.setup] Setting up sun
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain sun took 0.8 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up group
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain group took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up zone
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up input_number
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up input_datetime
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up lovelace
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up script
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain script took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up input_text
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up automation
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain automation took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up person
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up system_health
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain system_health took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain websocket_api took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up api
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up history
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain history took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up config
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up device_automation
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain device_automation took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain scene took 1.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain input_select took 1.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain input_boolean took 1.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain input_number took 0.2 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain input_datetime took 0.2 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain lovelace took 0.2 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain input_text took 0.1 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up auth
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain auth took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain api took 0.1 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up search
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain search took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain person took 0.1 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain config took 0.1 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain zone took 0.2 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up onboarding
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up zeroconf
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain onboarding took 0.1 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain zeroconf took 0.1 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up mobile_app
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up frontend
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain frontend took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain mobile_app took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up map
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain map took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up logbook
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain logbook took 0.0 seconds.
2020-04-13 14:00:09 INFO (SyncWorker_5) [homeassistant.loader] Loaded notify from homeassistant.components.notify
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up notify
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain notify took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.components.notify] Setting up notify.mobile_app
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.components.updater] Submitted analytics to Home Assistant servers. Information submitted includes {}
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain updater took 1.6 seconds.
2020-04-13 14:00:09 INFO (SyncWorker_3) [homeassistant.loader] Loaded binary_sensor from homeassistant.components.binary_sensor
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up default_config
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain default_config took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up binary_sensor
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain binary_sensor took 0.0 seconds.
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.updater
2020-04-13 14:00:09 INFO (SyncWorker_0) [homeassistant.loader] Loaded google_translate from homeassistant.components.google_translate
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setting up tts
2020-04-13 14:00:09 INFO (MainThread) [homeassistant.setup] Setup of domain tts took 0.0 seconds.
2020-04-13 14:00:11 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 7.50s
2020-04-13 14:00:11 INFO (MainThread) [homeassistant.core] Starting Home Assistant
2020-04-13 14:00:11 INFO (MainThread) [homeassistant.core] Timer:starting
2020-04-13 14:00:11 INFO (SyncWorker_0) [homeassistant.components.zeroconf] Starting Zeroconf broadcast
2020-04-13 14:00:11 INFO (SyncWorker_1) [homeassistant.loader] Loaded hue from homeassistant.components.hue

As Salaam a Likum. Firstly and foremostly - a BIG THANK YOU for creating this. Long story short, It took me about 8 hours how to setup hassio on a virtual machine and then followed your scripts to create the automation. I’ve just set it up … it played the Fajr azan just fine. Since it’s Ramadan, I wanted to go the extra mile and play Dua for sehri 45 seconds before the Fajr azan (since the play time for this dua is 20 seconds) - I figured it would be a good idea to set it up to play 45 seconds before. So as I read the entire thread, I figured if we could use the +xxxx (seconds) features to offset an azan, I figured I could use the -45 feature to offset it to PLAY BEFORE the Fajr azan. Here’e how I wrote it and IT DID NOT WORK — any suggestions?

  • NOTE: Surah Rahman played just fine, as written.

Automation for Dua for Sehri

  • action:
    • alias: ‘Play Sehri Dua’
      data:
      entity_id: media_player.office_speaker, media_player.family_room_speaker, media_player.family_room_speaker
      media_content_id: https://www.thesufi.com/Islamic-Collection/Islamic_Audio_Section/67-Islamic-Masnoon-Dua-Arabic-with-Urdu-Translation-MP3/Dua-and-Supplications--22-.mp3
      media_content_type: audio/mp3
      service: media_extractor.play_media
    • data:
      entity_id: media_player.office_speaker, media_player.family_room_speaker
      volume_level: ‘0.7’
      service: media_player.volume_set
      alias: Play Sehri Dua
      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”))-45 }}’

Automation for Surah Rahman

  • action:
    • alias: ‘Play Surah Rahman’
      data:
      entity_id: media_player.office_speaker, media_player.family_room_speaker
      media_content_id: http://www.humariweb.com/quran/ar-ur/55-(hamariweb.com).mp3
      media_content_type: audio/mp3
      service: media_extractor.play_media
    • data:
      entity_id: media_player.office_speaker, media_player.family_room_speaker
      volume_level: ‘0.7’
      service: media_player.volume_set
      alias: Play Surah Rahman
      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”))+300 }}’

Hi Assalamu Alaikum

I am having difficulty getting the islamic_prayer_times sensor working. I followed the steps above. I can manually run the automation action. But the sensor does not work. I dont see the sensors listed in the entities either.

Am I missing something? Pleas help.

Hi Assalamu Alaikum I am having difficulty getting the islamic_prayer_times sensor working. I followed the steps above. I can manually run the automation action. But the sensor does not work. I dont see the sensors listed in the entities either. Am I missing something? Pleas help.

Hi Cyben76

Could you or anyone please be so kind and post the whole configuration. I’m new to Hass and cant wait to configure Adhan over my speakers home.
I must say that the layout looks great. Keep up the GREAT works guys and thank you in advance.

Waalaikumsalam,

Did you follow this: https://www.home-assistant.io/integrations/islamic_prayer_times

Thanks Effendy

Yes, I followed these instructions.

Looks like pip is failing to install the sensor.

Any manual option to install this?

Thanks

Thanks

Firoz Ozman

Here is my setup. I am using 0.109.0 HA on a raspberry pi. I have configure it to have a static ip.

You should include the Islamic Prayer Times integration. See the screenshot below.

Then my configuration.yaml file looks like as follow.


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Text to speech
tts:
  - platform: google_translate

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

media_extractor:

sensor:
    - platform: time_date
      display_options:
        - 'time'
        - 'date'
        - 'date_time'
        - 'time_date'
        - 'time_utc'
        - 'beat'

and my automations.yaml file looks like this

- id: '2020042901'
  alias: Adhan Fajr
  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:
  - data:
      volume_level: 0.4
    entity_id: media_player.kitchen_display
    service: media_player.volume_set
  - data:
      entity_id: media_player.kitchen_display
      media_content_id: http://192.168.0.199:8123/local/azan2.mp3
      media_content_type: audio/mp3
    service: media_player.play_media
  - delay: 00:04:54

- id: '2020042902'
  alias: Adhan Dhuhr and Asr
  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"))
      }}'
  condition: []
  action:
  - data:
      volume_level: 0.6
    entity_id: media_player.kitchen_display
    service: media_player.volume_set
  - data:
      entity_id: media_player.kitchen_display
      media_content_id: http://192.168.0.199:8123/local/azan1.mp3
      media_content_type: audio/mp3
    service: media_player.play_media
  - delay: 00:03:09

- id: '151769301093'
  alias: Adhan Maghrib and Isha
  trigger:
  - 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:
  - data:
      volume_level: 0.4
    entity_id: media_player.kitchen_display
    service: media_player.volume_set
  - data:
      entity_id: media_player.kitchen_display
      media_content_id: http://192.168.0.199:8123/local/azan1.mp3
      media_content_type: audio/mp3
    service: media_player.play_media
  - delay: 00:03:09

I am using two audio files. The audio files can be downloaded from the link https://gofile.io/?c=1ymMjM

The files should be uploaded to “www” folder under config.

You can install file editor addon to work with files. See screenshot below.

After doing all, restart your server. Hope this helps.

Thank you for these instruction which have worked well for me to change configuration from before however the “delay” setting is not having any effect on the automation. I have added a delay of 4 minutes to the Dhur timing but the Adhan played at same time as per sensor default. Any Idea what I maybe doing wrong. Extract from automation.yaml below.

` # Automation for Dhuhr - Main Lounge

  • id: ‘2020050302’
    alias: Dhuhr 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”))
      }}’

    condition: []
    action:

    • data:
      volume_level: 0.6
      entity_id: media_player.googlehomehub9514
      service: media_player.volume_set
    • data:
      entity_id: media_player.googlehomehub9514
      media_content_id: http://192.168.0.210:8123/local/azan.mp3
      media_content_type: audio/mp3
      service: media_player.play_media
    • delay: 00:04:00 `

The delay is based on the audio file length and adds a delay for next execution in automation. For example if the azan.mp3 was 4 minutes and 2 seconds then a delay of 00:04:02 will delay the next command for 4 minutes 2 seconds. What you need to do is add 4 minutes in the calculation in the trigger section.

as_timestamp(strptime(states(“sensor.dhuhr_prayer”), “%Y-%m-%dT%H:%M:%S”)) + 240
}}’

Hope this helps.

jazakallah khair

Perhaps you haven’t positioned your delay key properly? check my setup perhaps that’ll help.

Salah Dashboard

Can all the prayer be confined into one single automation, instead of being separated?

Please share your config.

Thanks