Show next Active Alarm at Frontend

I build a Clock Alarm myself in HomeAssistent and my goal is to show the next active alert at the frontend. I have problems working with “today” and it’s getting a long code now. The Clock Alarm itself is working.

That are the Helpers:

And what I got so far at the Template Editor:

{% if is_state('input_boolean.wecker_monday_toggle', 'on') %}
  {{states('input_datetime.wecker_monday')}}
{% elif is_state('input_boolean.wecker_tuesday_toggle', 'on') %}
  {{states('input_datetime.wecker_tuesday')}}
{% elif is_state('input_boolean.wecker_wednesday_toggle', 'on') %}
  {{states('input_datetime.wecker_wednesday')}}
{% elif is_state('input_boolean.wecker_thursday_toggle', 'on') %}
  {{states('input_datetime.wecker_thursday')}}
{% elif is_state('input_boolean.wecker_friday_toggle', 'on') %}
  {{states('input_datetime.wecker_friday')}}
{% elif is_state('input_boolean.wecker_saturday_toggle', 'on') %}
  {{states('input_datetime.wecker_saturday')}}
{% elif is_state('input_boolean.wecker_sunday_toggle', 'on') %}
  {{states('input_datetime.wecker_sunday')}}
{% else %}
    OFF
{% endif %}
{{ (now() + timedelta(days=1)).strftime('%A') }}
{% set x = now().strftime("%A")|lower %}
{% set y = (now() + timedelta(days=z)).strftime("%A")|lower %}
{% set z = z+1 %}

{% set alarmtime = "input_datetime.wecker_"~x~"" %}
{% set alarmswitch = "input_boolean.wecker_"~x~"_toggle" %}

Someone could help me to make the code not that long?
In my first try, I get the active Alert but now I need to change it from “today”, like “Sunday” and search for the active boolean, and then show the time.

I’ve build this Monster for my solution. I’m not happy but it show’s the correct alarm:

{% set d0 = (now() + timedelta(hours=+18)).strftime("%A")|lower %}
{% set d1 = (now() + timedelta(hours=+42)).strftime("%A")|lower %}
{% set d2 = (now() + timedelta(hours=+66)).strftime("%A")|lower %}
{% set d3 = (now() + timedelta(hours=+90)).strftime("%A")|lower %}
{% set d4 = (now() + timedelta(hours=+114)).strftime("%A")|lower %}
{% set d5 = (now() + timedelta(hours=+138)).strftime("%A")|lower %}
{% set d6 = (now() + timedelta(hours=+162)).strftime("%A")|lower %}
{% set at0 = "input_datetime.wecker_"~d0~"" %}
{% set as0 = "input_boolean.wecker_"~d0~"_toggle" %}
{% set at1 = "input_datetime.wecker_"~d1~"" %}
{% set as1 = "input_boolean.wecker_"~d1~"_toggle" %}
{% set at2 = "input_datetime.wecker_"~d2~"" %}
{% set as2 = "input_boolean.wecker_"~d2~"_toggle" %}
{% set at3 = "input_datetime.wecker_"~d3~"" %}
{% set as3 = "input_boolean.wecker_"~d3~"_toggle" %}
{% set at4 = "input_datetime.wecker_"~d4~"" %}
{% set as4 = "input_boolean.wecker_"~d4~"_toggle" %}
{% set at5 = "input_datetime.wecker_"~d5~"" %}
{% set as5 = "input_boolean.wecker_"~d5~"_toggle" %}
{% set at6 = "input_datetime.wecker_"~d6~"" %}
{% set as6 = "input_boolean.wecker_"~d6~"_toggle" %}

{% if is_state(as0, 'on') %}
{{(now() + timedelta(hours=+18)).strftime("%a")}} {{states(at0)}}
{% elif is_state(as1, 'on') %}
{{(now() + timedelta(hours=+42)).strftime("%a")}}  {{states(at1)}}
{% elif is_state(as2, 'on') %}
{{(now() + timedelta(hours=+66)).strftime("%a")}}  {{states(at2)}}
{% elif is_state(as3, 'on') %}
{{(now() + timedelta(hours=+90)).strftime("%a")}}  {{states(at3)}}
{% elif is_state(as4, 'on') %}
{{(now() + timedelta(hours=+114)).strftime("%a")}}  {{states(at4)}}
{% elif is_state(as5, 'on') %}
{{(now() + timedelta(hours=+138)).strftime("%a")}}  {{states(at5)}}
{% elif is_state(as6, 'on') %}
{{(now() + timedelta(hours=+162)).strftime("%a")}}  {{states(at6)}}
{% else %}
OFF
{% endif %}

image

The Code is long but it works. I’ve made a template sensor and now can show the alarm in the Chip:
image