|
|
|
# Loads default set of integrations. Do not remove. |
|
default_config: |
|
|
|
# Load frontend themes from the themes folder |
|
frontend: |
|
themes: !include_dir_merge_named themes |
|
|
|
automation: !include automations.yaml |
|
script: !include scripts.yaml |
|
scene: !include scenes.yaml |
|
|
|
homeassistant: |
|
external_url: "http://mydomain.duckdns.org" # optional for remote access |
|
|
|
http: # optional for remote access |
|
ssl_certificate: /ssl/fullchain.pem |
|
ssl_key: /ssl/privkey.pem |
|
use_x_forwarded_for: true |
|
trusted_proxies: |
|
- 172.30.33.0/24 |
|
|
|
mobile_app: |
|
|
|
sensor: |
|
- platform: time_date |
|
display_options: |
|
- 'time' |
|
- 'date' |
|
- 'date_time' |
|
- 'time_date' |
|
- 'time_utc' |
|
|
|
############################### |
|
# Prayer Times Widget Sensors # |
|
############################### |
|
|
|
- platform: template |
|
sensors: |
|
next_prayer: |
|
friendly_name: Next Prayer |
|
value_template: >- |
|
{% set now = strptime(states("sensor.date_time"), "%Y-%m-%d, %H:%M") | as_timestamp | timestamp_custom('%H:%M %p') %} |
|
{% set imsak = states('sensor.islamic_prayer_times_midnight_time') | as_timestamp | timestamp_custom('%H:%M %p') %} |
|
{% set fajr = states('sensor.islamic_prayer_times_fajr_prayer')| as_timestamp | timestamp_custom('%H:%M %p') %} |
|
{% set dhuhr = states('sensor.islamic_prayer_times_dhuhr_prayer')| as_timestamp | timestamp_custom('%H:%M %p') %} |
|
{% set asr = states('sensor.islamic_prayer_times_asr_prayer')| as_timestamp | timestamp_custom('%H:%M %p') %} |
|
{% set maghrib = states('sensor.islamic_prayer_times_maghrib_prayer')| as_timestamp | timestamp_custom('%H:%M %p') %} |
|
{% set isha = states('sensor.islamic_prayer_times_isha_prayer')| as_timestamp | timestamp_custom('%H:%M %p') %} |
|
|
|
{% if now < imsak %} |
|
{{ states('sensor.islamic_prayer_times_midnight_time') }} |
|
{% elif imsak <= now < fajr %} |
|
{{ states('sensor.islamic_prayer_times_fajr_prayer') }} |
|
{% elif fajr <= now < dhuhr %} |
|
{{ states('sensor.islamic_prayer_times_dhuhr_prayer') }} |
|
{% elif dhuhr <= now < asr %} |
|
{{ states('sensor.islamic_prayer_times_asr_prayer') }} |
|
{% elif asr <= now < maghrib %} |
|
{{ states('sensor.islamic_prayer_times_maghrib_prayer') }} |
|
{% elif maghrib <= now < isha %} |
|
{{ states('sensor.islamic_prayer_times_isha_prayer') }} |
|
{% else %} |
|
{% set tomorrow = now + timedelta(days=1) %} |
|
{% set tomorrow_str = tomorrow.strftime('%Y-%m-%d') %} |
|
{{ states('sensor.islamic_prayer_times_fajr_prayer', {'date': tomorrow_str}) }} |
|
{% endif %} |
|
|
|
- platform: template |
|
sensors: |
|
time_until_next_prayer: |
|
friendly_name: Time Until Next Prayer |
|
value_template: >- |
|
{% set current_time = now().strftime('%H:%M') %} |
|
{% set next_prayer = states('sensor.next_prayer') %} |
|
{% set next_prayer_datetime = next_prayer | as_datetime %} |
|
{% set current_datetime = strptime(current_time, '%H:%M').replace(year=next_prayer_datetime.year, month=next_prayer_datetime.month, day=next_prayer_datetime.day, tzinfo=now().tzinfo) %} |
|
{% if current_datetime < next_prayer_datetime %} |
|
{{ (next_prayer_datetime - current_datetime).total_seconds() }} |
|
{% else %} |
|
{{ (next_prayer_datetime + timedelta(days=1) - current_datetime).total_seconds() }} |
|
{% endif %} |
|
unit_of_measurement: seconds |
|
|
|
- platform: template |
|
sensors: |
|
time_until_next_prayer_formatted: |
|
friendly_name: Time Until Next Prayer Formatted |
|
value_template: >- |
|
{% set total_seconds = states('sensor.time_until_next_prayer') | float %} |
|
{% set hours = (total_seconds // 3600) | int %} |
|
{% set minutes = ((total_seconds % 3600) // 60) | int %} |
|
{{ '%02d:%02d' % (hours, minutes) }} |
|
|