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

Thanks for this amazing and great work you have done, now one thing i feel bad about is to keep the raspberry on 24/7, because that solution will not be 100% perfect…my question is there any alternative ways without keeping the raspberry on all the time on… i thought that once we do the setup for one time…the configurations will be set on home assistant device and that will be for one time.

cant we have a way like fajer clock ?! prayer timings will be updated by itself? or a formula set there to achieve this?

can you please explain that?

thanks,
farooq a.aziz

Esalam Alikoum , as shown in th pic , my RaspberryPi3 works around the clock more than 2 years ma’shallah , it’s been the main smart home Hub running 24/7 ,the only thing that I have changed is the fan type , from time to time , so ya it’s reliable with less power usage.
But if you insist to switch OFF the RPi3 , I would recommend to get a smart plug , I would also recommend to set automation to switch off HomeAssistant 1st then say after 5minuts
the plug will switch off
I hope you got my idea

@s3.leo thanks dear for your reply, really appreciate it… what i am thinking is that i would like to utilize as much as i can with google mini home…and adding azan is very lovely as concept…but adding another device to run the notification automation based on raspberry update as 24/7 is not practical solution… because as cost using fajer clock or mobile is less cost… “i know i can use these options, for anybody if they will ask :slight_smile: … to go for that”…but i would love to test this on my home mini google but is there an alternative way without keeping raspberry working as 24/7…and also smart switch is also not practical… i am just brainstorming with you since you are the experts in this

Assalammualaikum all,

im trying to figure out why my automation is not working. It was working before the update… now running on HA 5.10. Attached is the image. I can’t figure out why on earth it has stopped working. i didnt make any changes. the links are the same and i am able to open the links when i copy them and open them. It loads fine. i am clueless. my house has been without azan,duas for weeks now. it is too quiet. I have tried editing the code - but was never successful.

This is the automation:

# Automation for 4 times Azan
- action:
  - alias: 'Azan'
    data:
      entity_id: media_player.living_speaker
      media_content_id: https://drive.google.com/open (removed)
      media_content_type: audio/mp3
    service: media_extractor.play_media
  - data:
      entity_id: media_player.living_speaker
      volume_level: '0.9'
    service: media_player.volume_set
    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")) +180}}'
    - 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")) +60}}'
    - 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")) +180}}'
    - 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")) - 780}}'

This is the config:

homeassistant:
  latitude: 3.1380306
  longitude: 101.5985415
  unit_system: metric
  time_zone: Asia/Kuala_Lumpur
  media_dirs:
    media: /media
    
default_config:
discovery:
media_extractor:
sun:

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

# Text to speech
tts:
  - platform: google_translate

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

image

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 ?