for the configuration.yaml, I used your supplementary code which included sensors showing the actual time on a card on overview:
herewith:
# 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
- platform: template
sensors:
salah_fajr:
friendly_name: "Salah Fajr"
value_template: >
{%- set a = states("sensor.islamic_prayer_time_fajr").split("T")[1].split(":")[0] -%}
{%- set b = states("sensor.islamic_prayer_time_fajr").split("T")[1].split(":")[1] -%}
{{ a + ":" + b }}
salah_dhuhr:
friendly_name: "Salah Dhuhr"
value_template: >
{%- set a = states("sensor.islamic_prayer_time_dhuhr").split("T")[1].split(":")[0] -%}
{%- set b = states("sensor.islamic_prayer_time_dhuhr").split("T")[1].split(":")[1] -%}
{{ a + ":" + b }}
salah_asr:
friendly_name: "Salah Asr"
value_template: >
{%- set a = states("sensor.islamic_prayer_time_asr").split("T")[1].split(":")[0] -%}
{%- set b = states("sensor.islamic_prayer_time_asr").split("T")[1].split(":")[1] -%}
{{ a + ":" + b }}
salah_maghrib:
friendly_name: "Salah Maghrib"
value_template: >
{%- set a = states("sensor.islamic_prayer_time_maghrib").split("T")[1].split(":")[0] -%}
{%- set b = states("sensor.islamic_prayer_time_maghrib").split("T")[1].split(":")[1] -%}
{{ a + ":" + b }}
salah_isha:
friendly_name: "Salah isha"
value_template: >
{%- set a = states("sensor.islamic_prayer_time_isha").split("T")[1].split(":")[0] -%}
{%- set b = states("sensor.islamic_prayer_time_isha").split("T")[1].split(":")[1] -%}
{{ a + ":" + b }}
For the automations.yaml,
I saw that you still had the original sensors in the configuration, so I reverted to you original code:
Herewith the code for the 4 triggers except Fajr:
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"))+3000 }}'
- 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"))+180 }}'
- 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")) }}'
I offset Asr by 50min to adjust for HAnafi time. its not exact, but close enough for at least 3 months in my location
I offset Magrib by 3 min because the Magrib sensor seems to actually calculate sunset. I allowed for the usual 3 minutes to allow the sundisk to fully clear the horizon at my altitude
for the Fajr automation, the only reason I separated was to find the appropriate Azaan MP3 file. haven’t yet found one that I like, but herewith the code in the automations.yaml (same as your code):
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")) }}'
but I found your supplemental code works just as well, but I cannot find a way to offset the time in this code:
trigger:
- platform: template
value_template: "{{ states('sensor.salah_fajr') == states('sensor.time') }}"
Hope this helps:
Its all your work though, Thank you