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

Hi I ahave been struggling to get this to work at all
would you be able to share the full configuration again (configuration.yaml) and any other bits needed
I am trying to get it working on my google minis
Jazaka Allah Khairan

Anybody can help with my code… I dont know what is wrong…

Or shud I just start from scratch again?

Salaam, I have an issue where the automation doesn’t run at all, everything works perfectly fine when executing it manually however, any solutions?

I am using the Islamic Prayer integration in HA.

Code:

  - 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:
  - data:
      volume_level: 0.2
    entity_id: media_player.home_speakers
    service: media_player.volume_set
  - data:
      entity_id: media_player.home_speakers
      media_content_id: http://192.111.1.11/local/audio/azan1.mp3
      media_content_type: audio/mp3
    service: media_player.play_media
  - delay: 00:03:00
  mode: single```

Did you find a fix for this?

اسلم عليكم ورحمة الله Brothers,

Does anyone have automation.yaml code on how to offset the prayer times , like I want my one light to turn on 30 minutes before Fajr sets in , I’ve tried using “offset” under trigger but it produces an error.

I tried this code, it is working great. but i dont get why i can’t use youtube link, or google drive or one drive link.

i’ve tried to put the mp3 in the media browser as well and tried linking it by using http://XXXip:8132/local/themp3 file but not working as well. kept getting error about make sure IP is reachable. But your azan link works normal. i dont get why.

- alias: Call to prayer example
  trigger:
  - platform: time
    at: 
    - sensor.fajr_prayer
    - sensor.dhuhr_prayer
    - sensor.asr_prayer
    - sensor.maghrib_prayer
    - sensor.isha_prayer
  action:
  - service: media_player.play_media
    data:
      entity_id: media_player.living_room
      media_content_id: https://www.islamcan.com/audio/adhan/azan1.mp3
      media_content_type: music
  - service: media_player.volume_set
    data:
      entity_id: media_player.living_room
      volume_level: '0.5'

Salam - may i know how you put the local audio?
I have tried putting the audio in media browser but when i put the link into the automation, it says IP not reachable.

so wondering how you got it to work manually.

by the way, perhaps u can share your configuration as well.

Ok finally got it to work with other links. Still doesn’t work with one drive or Google drive… So i uploaded to Dropbox and it is working…

The key word is media extractor instead of media player.

If you are playing directly from a. Mp3 file then use media player… If not use media extractor.

It works both ways, you just need to make sure the file path is accessible, by directly visiting the link.

Yes, it works both ways nowaday.

Hi brother thanks for you postings it was helpful. I was able to add .mp3 locally.
I added it in: A:\hassio\homeassistant\www
in automation: media_content_id: /local/Most Beautiful Azan.mp3 for audio and actually you can add it as .mp4 if you want video. i used Youtube to mp4.

Could someone share their full working code using Islamic Prayer Times? jzk

This my automation , I shifted to manual daily input on my HomePods for more accurate azan timings

Hopefully I helped

alias: Azan notifying
description: ‘’
trigger:

  • platform: time
    at:
    • sensor.fajr_prayer
    • sensor.dhuhr_prayer
    • sensor.asr_prayer
    • sensor.maghrib_prayer
    • sensor.isha_prayer
      condition: []
      action:
  • service: media_player.play_media
    data:
    media_content_type: SPOTIFY
    media_content_id: Azan Makah 3
    entity_id: media_player.saud_echo_dot
  • data:
    message: حان وقت الآذان
    title: ‘({{ now().strftime("%H:%M")}})’
    service: notify.all_devices
    mode: single
1 Like

alias: Azan notifying
description: ‘’
trigger:

  • platform: time
    at:
    • sensor.fajr_prayer
    • sensor.dhuhr_prayer
    • sensor.asr_prayer
    • sensor.maghrib_prayer
    • sensor.isha_prayer
      condition: []
      action:
  • service: media_player.play_media
    data:
    media_content_type: SPOTIFY
    media_content_id: Azan Makah 3
    entity_id: media_player.saud_echo_dot
  • data:
    message: حان وقت الآذان
    title: ‘({{ now().strftime("%H:%M")}})’
    service: notify.all_devices
    mode: single

Does anyone know how to modify the automation to do daylight saving?
It was working fine until we set the clock to +1 today

I need help with that too. Now that we moved 1 hour ahead how do we update Athan timing ?

This is not working for daylight saving because the sensors are in UTC

Jzk, I’m guessing this only works using yaml directly and not the UI?

Yes you can via UI , but it’s much easier via yaml
As shown in photos

It was fixed the next day after the switch to DST. I opened an issue with the developers