Can you please share yours. my automatiion does not trigger automaticaly… manually it works fine.
Sure! I am using Alexa device but you can modify it to suit your devices and liking. In addition, you have to add the Islamic prayer time integration from the settings<devices and service<add integration. Once add it and configure it to the preferred time calculation, you can use the automation below. You might need to restart HA prior to that.
alias: Adthan call through Alexa echo
description: ""
trigger:
- platform: time
at: sensor.dhuhr_prayer
id: dhuhr
- platform: time
at: sensor.asr_prayer
id: Asr
- platform: time
id: Maghrib
at: sensor.maghrib_prayer
- platform: time
id: Isha
at: sensor.isha_prayer
- platform: time
id: fajr
at: sensor.fajr_prayer
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: dhuhr
sequence:
- service: notify.family
data:
message: حان الآن موعد صلاة الظهر
title: 🕌 Prayer Time 🕌
- service: notify.alexa_media
data:
message: <audio src='https://yourhomeassistanturl/local/audio/duhradthan.mp3'/>
target:
- media_player.kitchen_s_echo_show
- media_player.master_show
data:
type: tts
- conditions:
- condition: trigger
id: Asr
sequence:
- service: notify.family
data:
message: حان الآن موعد صلاة العصر
title: 🕌 Prayer Time 🕌
- service: media_player.volume_set
data:
volume_level: 0.7
target:
entity_id:
- media_player.kitchen_show
- media_player.master_show
- service: notify.alexa_media
data:
message: <audio src='https://yourhomeassistanturl/local/audio/asradthan1.mp3'/>
target:
- media_player.kitchen_show
- media_player.master_show
data:
type: tts
- conditions:
- condition: trigger
id: Maghrib
sequence:
- service: notify.family
data:
message: حان الآن موعد صلاة المغرب
title: 🕌 Prayer Time 🕌
- service: notify.alexa_media
data:
message: <audio src='https://yourhomeassistanturl/local/audio/maghribadthan.mp3'/>
target:
- media_player.kitchen_show
- media_player.living_room_show
- media_player.master_show
data:
type: tts
- conditions:
- condition: trigger
id: Isha
sequence:
- service: notify.family
data:
message: حان الآن موعد صلاة العشاء
title: 🕌 Prayer Time 🕌
- service: notify.alexa_media
data:
message: <audio src='https://yourhomeassistanturl/local/audio/ishaadthan.mp3'/>
target:
- media_player.kitchen_show
- media_player.living_room_show
- media_player.master_show
data:
type: tts
- conditions:
- condition: trigger
id: fajr
sequence:
- service: notify.family
data:
message: حان الآن موعد صلاة الفجر
title: 🕌 Prayer Time 🕌
- service: notify.alexa_media
data:
message: <audio src='https://yourhomeassistanturl/local/audio/subhadthan.mp3'/>
target:
- media_player.living_room_show
- media_player.master_show
- media_player.kids_dot
data:
type: tts
mode: single
Notes: https://yourhomeassistanturl must be changed to match the path or source where the adthan audio file is located. I am using my own audio mp3 for all the five prayers since Alexa is very delicate about that.
Hope that will help you brother!
Brothers - I have the configuration working for a while. However, my Nest Mini speaker is unfindable all the sudden and not able cast the Adhan to it. Could anyone help?
Sometimes my Nest speakers get disconnected without any reason, usually rebooting Nests solves my problem. Also try checking if they’re connected to WiFi, and on same network to HA.
Thanks for the response @chintito4ever. Yes both the nest mini and Audio connected to the same wifi as HA.However it is still unfindable. I have a new Nest Audio and Nest Mini which are not findable as an Entity or as a Devices.
I do have a Sonos Beam speaker and Google Chromecast. Those are findable as entities without any issues. I am missing anything here?
Hi @msahar and brothers,
I am having the same configuration and automation content but it is not triggering the azan automatically. Manually, I can able to trigger and it plays without issue.
Code of configuration.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
# to find lat and long - https://www.maps.ie/coordinates.html
homeassistant:
latitude: 43.75167
longitude: -79.26541
unit_system: metric
time_zone: America/Toronto
external_url: "secrect!"
media_dirs:
media: "/media"
default_config:
discovery:
media_extractor:
sun:
# Islamic prayer times integration starts updated 12/04/22
# Sensors
sensor:
- platform: time_date
display_options:
- "time"
- "date"
- "date_time"
- "time_date"
- platform: islamic_prayer_times
calculation_method: isna
sensors:
- fajr
- dhuhr
- asr
- maghrib
- isha
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# Test
Code for automation.yaml
# Automation for Fajr times Adhan(consists of 3 parts theaction, thealias and thetrigger)
- action:
- alias: "FajrAdhan"
data:
entity_id: media_player.nestmini8653
media_content_id: http://myip:8123/local/adhan/fajr-adhan-mansoor.mp3
media_content_type: audio/mp3
service: media_extractor.play_media
- data:
entity_id: media_player.nestmini8653
volume_level: "0.6"
service: media_player.volume_set
alias: Fajr_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")) }}'
# Automation for 4 times Azan
- action:
- alias: "FourAdhan"
data:
entity_id: media_player.nestmini8653
media_content_id: http://myip:8123/local/adhan/all-adhan-mishary.mp3
media_content_type: audio/mp3
service: media_extractor.play_media
- data:
entity_id: media_player.nestmini8653
volume_level: "0.8"
service: media_player.volume_set
alias: Four_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")) }}'
- 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")) }}'
- 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")) }}'
- 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")) }}'
### Restart HA to force update Islamic Time Sensors at 1AM ###
- alias: Restart HA
trigger:
platform: time
at: "01:00:00"
action:
- service: homeassistant.restart
Attaching the states screenshots. The sensor for dhuhr is mentioned as ‘2022-12-05T17:08:00+00:00’. I am sure this is not the correct time for dhuhr in North America (Toronto). Similarly for all the other prayers. Is that anything configured incorrectly? Please help.
If you go to Settings>Automation>Your Adhan Automation>Traces it should show the logs why it failed. Can you see what your traces show?
Thanks for the response @chintito4ever. I am not anything when clicked the trace. Is that any other place i need to look at?
I am able to enable the tracing after restart of HA instance. Now by manually triggering the automation for Fajr and All four Adan, Trace is available. PFB.
However, I am still seeing the sensor times are incorrect for the Toronto, Canada location. Do you see any issues below?
Dear brothers,
The automation is working for me now. I have updated my automations.yaml file as follows.
# Automation for 4 times Azan
- action:
- alias: "FourAdhan"
data:
entity_id: media_player.nestmini8653
media_content_id: http://local:8123/local/adhan/all-adhan-mishary.mp3
media_content_type: audio/mp3
service: media_extractor.play_media
- data:
entity_id: media_player.nestmini8653
volume_level: "0.8"
service: media_player.volume_set
alias: Four_Adhan
condition: []
id: "1517694139312"
trigger:
- platform: template
value_template: '{{ now().timestamp()|int == as_timestamp(states("sensor.dhuhr_prayer")) }}'
- platform: template
value_template: '{{ now().timestamp()|int == as_timestamp(states("sensor.asr_prayer")) }}'
- platform: template
value_template: '{{ now().timestamp()|int == as_timestamp(states("sensor.maghrib_prayer")) }}'
- platform: template
value_template: '{{ now().timestamp()|int == as_timestamp(states("sensor.isha_prayer")) }}'
Based on the logs and suggestion from following threads, I am able to resolve it. Islamic Prayer Times issue with the sensor integration after Core update - does not support platform setup · Issue #73201 · home-assistant/core · GitHub
Offset time - #37 by om3r
Salaam Brothers,
I have the automation working perfectly minus one small thing. The Islamic Prayer Time integration doesn’t have a calculation for the UK, the closest is MWL but it isn’t correct. Is there a way I can correct this without having to change anything constantly.
Thanks
Salaam everyone,
can someone help me do azan automation but play via alexa
prayer time: London
Thanks
It’s been described here
Can you help me with configuration and automation with diyanet Netherlands files?
Can you please put more clarification about what you need?
are you using my addo? if yes there is a description how to configure that
I’ve been trying to get your addon to work but I’m getting unknown when I remove == states(‘sensor.time’) and always false if I dont.
If I run http://localhost:1453/api/dailyPrayerTimes/11421 I get correct results
{"regionId":11421,"region":"Melbourne","prayerTimes":[{"date":"23.03.2023","fajr":"05:58","sun":"07:18","dhuhur":"13:32","asr":"16:56","maghrib":"19:36","isha":"20:51"},{"date":"24.03.2023","fajr":"05:59","sun":"07:19","dhuhur":"13:32","asr":"16:55","maghrib":"19:34","isha":"20:49"}]}
This is what I have added in my configuration.yaml
- platform: rest
name: namaz_vakti
resource: "http://localhost:1453/api/dailyPrayerTimes/11421"
scan_interval: 25200
json_attributes_path: $.prayerTimes[0]
json_attributes:
- date
- fajr
- sun
- dhuhur
- asr
- maghrib
- isha
value_template: >
{% set now = now() %}
{% set fajr = today_at(state_attr('sensor.namaz_vakti', 'fajr')) %}
{% set sun = today_at(state_attr('sensor.namaz_vakti', 'sun')) %}
{% set dhuhur = today_at(state_attr('sensor.namaz_vakti', 'dhuhur')) %}
{% set asr = today_at(state_attr('sensor.namaz_vakti', 'asr')) %}
{% set maghrib = today_at(state_attr('sensor.namaz_vakti', 'maghrib')) %}
{% set isha = today_at(state_attr('sensor.namaz_vakti', 'isha')) %}
{% if now < fajr %}
Imsak: {{ state_attr('sensor.namaz_vakti', 'fajr') }}
{% elif now < sun %}
Gunes: {{ state_attr('sensor.namaz_vakti', 'sun') }}
{% elif now < dhuhur %}
Oglen: {{ state_attr('sensor.namaz_vakti', 'dhuhur') }}
{% elif now < asr %}
Ikindi: {{ state_attr('sensor.namaz_vakti', 'asr') }}
{% elif now < maghrib %}
Aksam: {{ state_attr('sensor.namaz_vakti', 'maghrib') }}
{% elif now < isha %}
Yatsi: {{ state_attr('sensor.namaz_vakti', 'isha') }}
{% else %}
unknown
{% endif %}
- platform: template
sensors:
diyanet_imsak_vakti:
friendly_name: "Imsak Vakti"
value_template: "{{state_attr('sensor.namaz_vakti', 'fajr') }}"
diyanet_gunes_vakti:
friendly_name: "Gunes Vakti"
value_template: "{{state_attr('sensor.namaz_vakti', 'sun') }}"
diyanet_ogle_namazi:
friendly_name: "Ogle Vakti"
value_template: "{{state_attr('sensor.namaz_vakti', 'dhuhur') }}"
diyanet_ikindi_namazi:
friendly_name: "Ikindi Vakti"
value_template: "{{state_attr('sensor.namaz_vakti', 'asr') }}"
diyanet_aksam_namazi:
friendly_name: "Aksam Vakti"
value_template: "{{state_attr('sensor.namaz_vakti', 'maghrib') }}"
diyanet_yatsi_namazi:
friendly_name: "Yatsi Vakti"
value_template: "{{state_attr('sensor.namaz_vakti', 'isha') }}"
- platform: template
sensors:
imsak_notify:
friendly_name: "İmsak Vakti Notify"
value_template: "{{state_attr('sensor.namaz_vakti', 'fajr') == states('sensor.time')}}"
gunes_notify:
friendly_name: "Güneş Vakti Notify"
value_template: "{{state_attr('sensor.namaz_vakti', 'sun') == states('sensor.time')}}"
ogle_notify:
friendly_name: "Öğle Vakti Notify"
value_template: "{{state_attr('sensor.namaz_vakti', 'dhuhur') == states('sensor.time')}}"
ikindi_notify:
friendly_name: "İkindi Vakti Notify"
value_template: "{{state_attr('sensor.namaz_vakti', 'asr') == states('sensor.time')}}"
aksam_notify:
friendly_name: "Akşam Vakti Notify"
value_template: "{{state_attr('sensor.namaz_vakti', 'maghrib') == states('sensor.time')}}"
yatsi_notify:
friendly_name: "Yatsı Vakti Notify"
value_template: "{{state_attr('sensor.namaz_vakti', 'isha') == states('sensor.time')}}"
Hi Sahar,
I have been to setup the Adan integrations for a few days with little success, I can trigger adan manually if I run the script but the automation piece does not work - below are my config and automation files, if you coud kindly assist please -
Config File -
/
homeassistant:
latitude: 43.526646
longitude: -79.891205
elevation: 217
unit_system: metric
time_zone: America/Toronto
discovery:
media_extractor:
sun:
Islamic prayer times integration
islamic_prayer_times:
calculation_method: mwl
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 }}
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
/
my Automation File -
/
id: ‘1679835844405’
alias: Adhan
description: ‘’
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”))
}}’
condition: []
action: - alias: Azan
data:
entity_id: media_player.all_g_display
media_content_id: http://192.168.86.68:8123/local/AthanByYusufIslam.mp3
media_content_type: audio/mp3
service: media_extractor.play_media - data:
entity_id: media_player.all_g_display
volume_level: ‘0.6’
service: media_player.volume_set
mode: single - alias: Restart HA
trigger:
platform: time
at: 01:00:00
action:- service: homeassistant.restart
id: 6145b39c17954cc0a47b4e22e51193cb
- service: homeassistant.restart
- id: ‘1679837642811’
alias: Restart HA
description: ‘’
trigger:- platform: time
at: 01:00:00
condition: []
action: - service: homeassistant.restart
data: {}
mode: single
/
I live in Milton, Ontario , Canada - please see attachd picture for sensor status it shows unavailable all across.
- platform: time
I got this automation but its not triggering:
- id: ‘1676133222550’
alias: 1 Ezan Sabah
trigger:- platform: state
entity_id:- sensor.namaz_vakti
to: ‘True’
attribute: asr
condition: []
action:
- sensor.namaz_vakti
- service: media_player.play_media
data:
media_content_id: media-source://media_source/local/Azan.mp3
media_content_type: audio/mp3
target:
entity_id: media_player.keuken_display - service: media_player.volume_set
data:
volume_level: 0.4
target:
entity_id: media_player.keuken_display
mode: single
- platform: state