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

Oh yes, the issue was tbe youtube link wasn’t working. I’ve changed them and the Adhan and surahs are playing NORMALLY now. Still don’t know how to get it playing according to Malaysia timezone.

Hmm, I’m playing it locally, but still can’t get it to play anything at all.

Hello guys. The above guide is now a kind of redundant as the method of playing azan is now available as integration rather than sensors. I am trying to install hassio but due to some weird reason installation is failing continuously. I will update this guide once I get around this.

How do you display the “time” for each Namaz … Mine is showing “In X hours” by default.

image

Maybe try sharing your code? How are you playing it locally? I uploaded the mp3 to google drive and use the link from there, works just fine…

The only thing is the timing… Offset at set manually s if the original timing changes then my offset will be minutes off.

Some asked abt the offset… It should be in seconds… So if you need to start it 5 minutes before the timing, put - 360…

Hello,
If you look at my configuration.yaml file above there is a template being created for each prayer.
When you go to add an entity on your dashboard you have to select the friendly names Salah Fajr, Salah Dhuhur etc to show the times. Let me know if its still unclear and I will try to send screenshtos.

Hi @msahar, everything was working for a long time - also I had got some help from you in the past. But since updating to 0.109.6 yesterday I do not get any sensors detected. Is it what you referring to? I was playing some locally stored Adhan and some prayers with offset. What changes will I need to make in my files to get things back again? Here are my file outputs. Really need it working. I miss Adhan at the time of breaking fast. Thank you in advance.

configuration.yaml

homeassistant:
  customize: !include customize.yaml
  name: Home
  latitude: xxxxx
  longitude: xxxxx
  unit_system: metric
  time_zone: Asia/Hong_Kong

default_config:
discovery:
media_extractor:

# Sensors
sensor:
  - platform: time_date
    display_options:
      - 'time'
      - 'date'
      - 'date_time'
      - 'time_date'
  - platform: islamic_prayer_times
    calculation_method: karachi
    sensors:
      - fajr
      - dhuhr
      - asr
      - maghrib
      - isha
      - midnight

# Dark Sky Weather 
  - platform: darksky
    api_key: !secret darksky_api
    name: DarkSky
    monitored_conditions:
      - temperature
      - cloud_cover
      - humidity
      - pressure
      - temperature_high
      - temperature_low

# Asus router
asuswrt:
  host: 192.168.1.1
  username: 
  port: 
  ssh_key: /config/ssh/openssh2
  
telegram_bot:
  - platform: polling
    api_key: !secret Telegram_Api
    allowed_chat_ids:
      - !secret Telegram_Chat_Id
      
notify:
  - name: 
    platform: telegram
    chat_id: !secret Telegram_Chat_Id

      
      
# Text to speech
tts:
  - platform: google_translate

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

automation.yaml

# Automation for Azan
- action:
  - alias: 'Azan'
    data:
      entity_id: media_player.living_room_speaker
      media_content_id: http://192.168.1.10:8123/local/azans/azan2.mp3
      media_content_type: audio/mp3
    service: media_extractor.play_media
  - data:
      entity_id: media_player.living_room_speaker
      volume_level: '0.55'
    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.islamic_prayer_time_dhuhr"), "%Y-%m-%dT%H:%M:%S")) +240 }}'
    - platform: template
      value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_time_asr"), "%Y-%m-%dT%H:%M:%S")) +2700 }}'
    - platform: template
      value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_time_maghrib"), "%Y-%m-%dT%H:%M:%S")) +120 }}'
    - platform: template
      value_template: '{{ as_timestamp(strptime(states("sensor.time_date"), "%H:%M, %Y-%m-%d")) == as_timestamp(strptime(states("sensor.islamic_prayer_time_isha"), "%Y-%m-%dT%H:%M:%S")) +60 }}'

- action:
  - alias: 'Fajar Azan'
    data:
      entity_id: media_player.living_room_speaker
      media_content_id: http://192.168.1.10:8123/local/azans/fajarazan.mp3
      media_content_type: audio/mp3
    service: media_extractor.play_media
  - data:
      entity_id: media_player.living_room_speaker
      volume_level: '0.25'
    service: media_player.volume_set
  alias: Fajar Adhan
  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")) -60 }}'
      
      
      
     

automations.yaml

- id: 'idhere'
  alias: 'Adhan'
  description: Play Adhan on Google Home
  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.isha_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:
      entity_id: media_player.speaker_1
      media_content_id: https://url.com/local/audio/azan1.mp3
      media_content_type: audio/mp3
    service: media_extractor.play_media
  - data:
      entity_id: media_player.speaker_1
      volume_level: '0.8'
    service: media_player.volume_set

time_date.yaml

# Time and Date
- platform: time_date
  display_options:
    - 'time'
    - 'date'
    - 'date_time'
    - 'time_utc'
    - 'beat'
    - 'date_time_iso'

The Prayer Times is integrated using the HA Integrations, so there’s nothing in the configuration.yaml file.

Only

# Prayer Times
-  platform: islamic_prayer_times
  calculation_method: mwl 

Please have a look the op, I have updated it thanks

I guess there is some problem with this url. Are you sure that you are able to access azan1.mp3 at this url?

The url works fine, I’ve just blanked it out for privacy reasons.

Please use this automation file.

# Automation for 5 times Azan
- action:
  - alias: 'Azan'
    data:
      entity_id: media_player.speaker_1
      media_content_id: https://www.islamcan.com/audio/adhan/azan2.mp3
      media_content_type: audio/mp3
    service: media_extractor.play_media
  - data:
      entity_id: media_player.speaker_1
      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.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")) }}'

Hi @msahar any suggestion or idea please as why the timings displayed are UK GMT? I provided details above. Thank you.

Thanks, I have used the code you have attached, with some adjustments as there was some formatting errors, however I get the same issue. Nothing is being executed.

Also, what is the differences between this, and the method here?

Salaams Brother-
I am using a sonos wifi speaker- instead of a google speaker-
I have set up google assistant- followed all instructions-

I can’t see the Hassio.io - but used editor add on instead.
Everything has worked - but cannot trigger adhaan. :frowning:

please help

Please share your configuration.yaml and automation.yaml files.

I age done exactly as you stated.
I feel the only problem is that I don’t own a google speaker, I have so is speakers.
I have been able to connect my li to home assistant and able to send a message to Sonos through HA, cannot run code - please help …

Have followed all instructions- except that I don’t have a google mini, instead using google assistant with sonos wifi speaker… please help

I can’t seem to see how I can send you a private message, if you could kindly message me privately so I can respond and send more images.

Thank you for you help brother, sorry to be trouble

Hi @Himdola very nice adhan calenderyou have there could you share teh script with me or us

Had the same issue this is what you need to use for SONOS