|
## Official Islamic Prayer Time (extended) ## |
|
## https://www.home-assistant.io/integrations/islamic_prayer_times |
|
sensor: |
|
- platform: template |
|
sensors: |
|
imsak_time: |
|
friendly_name: "Imsak" |
|
device_class: timestamp |
|
icon_template: mdi:calendar-clock |
|
value_template: "{{ (as_timestamp(states('sensor.fajr_prayer')) | int - (10*60)) | timestamp_utc }}" |
|
now_prayer: |
|
friendly_name: "Prayer Time" |
|
icon_template: mdi:calendar-clock |
|
value_template: >- |
|
{%if now().timestamp() >= as_timestamp(states('sensor.imsak_time')) and now().timestamp() < as_timestamp(states('sensor.fajr_prayer')) %}Imsak |
|
{%elif now().timestamp() >= as_timestamp(states('sensor.fajr_prayer')) and now().timestamp() < as_timestamp(states('sensor.sunrise_time')) %}Fajr |
|
{%elif now().timestamp() >= as_timestamp(states('sensor.sunrise_time')) and now().timestamp() < as_timestamp(states('sensor.dhuhr_prayer')) %}Sunrise (Syuruk) |
|
{%elif now().timestamp() >= as_timestamp(states('sensor.dhuhr_prayer')) and now().timestamp() < as_timestamp(states('sensor.asr_prayer')) %}Dhuhr |
|
{%elif now().timestamp() >= as_timestamp(states('sensor.asr_prayer')) and now().timestamp() < as_timestamp(states('sensor.maghrib_prayer')) %}Asr |
|
{%elif now().timestamp() >= as_timestamp(states('sensor.maghrib_prayer')) and now().timestamp() < as_timestamp(states('sensor.isha_prayer')) %}Maghrib |
|
{%elif now().timestamp() >= as_timestamp(states('sensor.isha_prayer')) %}Isha |
|
{%endif%} |
|
attribute_templates: |
|
timestamp: >- |
|
{%if is_state('sensor.now_prayer', 'Imsak') %}{{ states('sensor.imsak_time') }} |
|
{%elif is_state('sensor.now_prayer', 'Fajr') %}{{ states('sensor.fajr_prayer') }} |
|
{%elif is_state('sensor.now_prayer', 'Syuruk') %}{{ states('sensor.sunrise_time') }} |
|
{%elif is_state('sensor.now_prayer', 'Dhuhr') %}{{ states('sensor.dhuhr_prayer') }} |
|
{%elif is_state('sensor.now_prayer', 'Asr') %}{{ states('sensor.asr_prayer') }} |
|
{%elif is_state('sensor.now_prayer', 'Maghrib') %}{{ states('sensor.maghrib_prayer') }} |
|
{%elif is_state('sensor.now_prayer', 'Isha') %}{{ states('sensor.isha_prayer') }} |
|
{%endif%} |
|
12hours: >- |
|
{%if is_state('sensor.now_prayer', 'Imsak') %}{{ as_timestamp(states('sensor.imsak_time')) | timestamp_custom('%I:%M %p') }} |
|
{%elif is_state('sensor.now_prayer', 'Fajr') %}{{ as_timestamp(states('sensor.fajr_prayer')) | timestamp_custom('%I:%M %p') }} |
|
{%elif is_state('sensor.now_prayer', 'Syuruk') %}{{ as_timestamp(states('sensor.sunrise_time')) | timestamp_custom('%I:%M %p') }} |
|
{%elif is_state('sensor.now_prayer', 'Dhuhr') %}{{ as_timestamp(states('sensor.dhuhr_prayer')) | timestamp_custom('%I:%M %p') }} |
|
{%elif is_state('sensor.now_prayer', 'Asr') %}{{ as_timestamp(states('sensor.asr_prayer')) | timestamp_custom('%I:%M %p') }} |
|
{%elif is_state('sensor.now_prayer', 'Maghrib') %}{{ as_timestamp(states('sensor.maghrib_prayer')) | timestamp_custom('%I:%M %p') }} |
|
{%elif is_state('sensor.now_prayer', 'Isha') %}{{ as_timestamp(states('sensor.isha_prayer')) | timestamp_custom('%I:%M %p') }} |
|
{%endif%} |
|
24hours: >- |
|
{%if is_state('sensor.now_prayer', 'Imsak') %}{{ as_timestamp(states('sensor.imsak_time')) | timestamp_custom('%H:%M') }} |
|
{%elif is_state('sensor.now_prayer', 'Fajr') %}{{ as_timestamp(states('sensor.fajr_prayer')) | timestamp_custom('%H:%M') }} |
|
{%elif is_state('sensor.now_prayer', 'Syuruk') %}{{ as_timestamp(states('sensor.sunrise_time')) | timestamp_custom('%H:%M') }} |
|
{%elif is_state('sensor.now_prayer', 'Dhuhr') %}{{ as_timestamp(states('sensor.dhuhr_prayer')) | timestamp_custom('%H:%M') }} |
|
{%elif is_state('sensor.now_prayer', 'Asr') %}{{ as_timestamp(states('sensor.asr_prayer')) | timestamp_custom('%H:%M') }} |
|
{%elif is_state('sensor.now_prayer', 'Maghrib') %}{{ as_timestamp(states('sensor.maghrib_prayer')) | timestamp_custom('%H:%M') }} |
|
{%elif is_state('sensor.now_prayer', 'Isha') %}{{ as_timestamp(states('sensor.isha_prayer')) | timestamp_custom('%H:%M') }} |
|
{%endif%} |
|
|
|
automation: |
|
- alias: π Adzan Automation |
|
description: Play Audio and Notification (Disable this if you wish to use your own) |
|
trigger: |
|
- platform: template |
|
value_template: >- |
|
{{ is_state_attr('sensor.now_prayer', '24hours', |
|
now().strftime('%H:%M'))}} |
|
id: solat |
|
condition: [] |
|
action: |
|
- choose: |
|
- conditions: |
|
- condition: template |
|
value_template: "{{ is_state('sensor.now_prayer', 'fajr') }}" |
|
sequence: |
|
- service: persistent_notification.create |
|
data: |
|
message: >- |
|
{{ now().strftime('%-I:%M %p') }} - It is now |
|
{{states('sensor.now_prayer')}} prayer. Perform your salah. |
|
notification_id: esolat_azan |
|
title: π Prayer Alert - {{states('sensor.now_prayer')}} |
|
- service: notify.notify |
|
data: |
|
message: >- |
|
{{ now().strftime('%-I:%M %p') }} - It is now |
|
{{states('sensor.now_prayer')}} prayer. Perform your salah. |
|
title: π Prayer Alert - {{states('sensor.now_prayer')}} |
|
- service: tts.google_translate_say |
|
data: |
|
entity_id: media_player.all_devices #Change this to your media player |
|
language: en |
|
message: >- |
|
It is now {{ states('sensor.now_prayer') }} prayer. Perform your |
|
salah. |
|
- delay: "00:00:10" |
|
- service: media_player.play_media |
|
target: |
|
entity_id: media_player.all_devices #Change this to your media player |
|
data: |
|
media_content_type: audio/mp3 |
|
media_content_id: media-source://media_source/local/adzan_fajr.mp3 |
|
extra: |
|
title: Adzan {{states('sensor.now_prayer')}} |
|
- conditions: |
|
- condition: template |
|
value_template: >- |
|
{{ is_state('sensor.now_prayer', 'Dhuhr') or |
|
is_state('sensor.now_prayer', 'Asr') or |
|
is_state('sensor.now_prayer', 'Maghrib') or |
|
is_state('sensor.now_prayer', 'Isha') }} |
|
sequence: |
|
- service: persistent_notification.create |
|
data: |
|
message: >- |
|
{{ now().strftime('%-I:%M %p') }} - It is now |
|
{{states('sensor.now_prayer')}} prayer. Perform your salah. |
|
notification_id: esolat_azan |
|
title: π Prayer Alert - {{states('sensor.now_prayer')}} |
|
- service: notify.notify |
|
data: |
|
message: >- |
|
{{ now().strftime('%-I:%M %p') }} - It is now |
|
{{states('sensor.now_prayer')}} prayer. Perform your salah. |
|
title: π Prayer Alert - {{states('sensor.now_prayer')}} |
|
- service: tts.google_translate_say |
|
data: |
|
entity_id: media_player.all_devices #Change this to your media player |
|
language: en |
|
message: >- |
|
It is now {{ states('sensor.now_prayer') }} prayer. Perform your |
|
salah. |
|
- delay: "00:00:10" |
|
- service: media_player.play_media |
|
target: |
|
entity_id: media_player.all_devices #Change this to your media player |
|
data: |
|
media_content_type: audio/mp3 |
|
media_content_id: media-source://media_source/local/adzan.mp3 |
|
extra: |
|
title: Azan {{states('sensor.now_prayer')}} |
|
default: [] |
|
mode: single |