Trigger automations based on time set in frontend

I want to select the weekdays and times in the frontend, in order to automate my sprinklers. For testing purposes i am trying to switch on an off a light based on this schedule. The frontend looks like this:

This is the yaml code for it:

      - type: vertical-stack
        cards:
          - type: entities
            show_header_toggle: false
            entities:
              - entity: light.kuche_1
              - entity: sensor.timer_1_start_time
                icon: mdi:clock-start
                name: Starten um...
              - type: custom:fold-entity-row
                padding: 0
                group_config:
                  toggle: false
                  type: custom:slider-entity-row
                head:
                  label: Uhrzeit
                  type: section
                items:
                  - entity: input_number.timer_1_start_hour
                  - entity: input_number.timer_1_start_minutes
              - entity: sensor.timer_1_finish_time
                name: Beenden um....
                icon: mdi:clock-end
              - type: custom:fold-entity-row
                padding: 0
                group_config:
                  toggle: false
                  type: custom:slider-entity-row
                head:
                  label: Uhrzeit
                  type: section
                items:
                  - entity: input_number.timer_1_finish_hour
                  - entity: input_number.timer_1_finish_minutes
          - type: horizontal-stack
            cards:
              - type: custom:button-card
                name: Mo
                entity: input_boolean.timer_1_mon
                icon: mdi:checkbox-blank-circle
                color: rgb(25, 155, 20)
                state:
                  - value: 'off'
                    icon: mdi:checkbox-blank-circle-outline
                    color: rgb(61,61,61)
              - type: custom:button-card
                name: Di
                entity: input_boolean.timer_1_tue
                icon: mdi:checkbox-blank-circle
                color: rgb(25, 155, 20)
                state:
                  - value: 'off'
                    icon: mdi:checkbox-blank-circle-outline
                    color: rgb(61,61,61)
              - type: custom:button-card
                name: Mi
                entity: input_boolean.timer_1_wed
                icon: mdi:checkbox-blank-circle
                color: rgb(25, 155, 20)
                state:
                  - value: 'off'
                    icon: mdi:checkbox-blank-circle-outline
                    color: rgb(61,61,61)
              - type: custom:button-card
                name: Do
                entity: input_boolean.timer_1_thu
                icon: mdi:checkbox-blank-circle
                color: rgb(25, 155, 20)
                state:
                  - value: 'off'
                    icon: mdi:checkbox-blank-circle-outline
                    color: rgb(61,61,61)
              - type: custom:button-card
                name: Fr
                entity: input_boolean.timer_1_fri
                icon: mdi:checkbox-blank-circle
                color: rgb(25, 155, 20)
                state:
                  - value: 'off'
                    icon: mdi:checkbox-blank-circle-outline
                    color: rgb(61,61,61)
              - type: custom:button-card
                name: Sa
                entity: input_boolean.timer_1_sat
                icon: mdi:checkbox-blank-circle
                color: rgb(25, 155, 20)
                state:
                  - value: 'off'
                    icon: mdi:checkbox-blank-circle-outline
                    color: rgb(61,61,61)
              - type: custom:button-card
                name: So
                entity: input_boolean.timer_1_sun
                icon: mdi:checkbox-blank-circle
                color: rgb(25, 155, 20)
                state:
                  - value: 'off'
                    icon: mdi:checkbox-blank-circle-outline
                    color: rgb(61,61,61)

Here are my defined input number:

##  START TIME 
timer_1_start_hour:
  name: Stunden
  icon: mdi:timer
  #initial: 6
  min: 0
  max: 23
  step: 1

timer_1_start_minutes:
  name: Minuten
  icon: mdi:timer
  #initial: 30
  min: 0
  max: 59

##  FINISH TIME 
timer_1_finish_hour:
  name: Stunden
  icon: mdi:timer
  #initial: 6
  min: 0
  max: 23
  step: 1

timer_1_finish_minutes:
  name: Minuten
  icon: mdi:timer
  #initial: 30
  min: 0
  max: 59
  step: 1

Here are my defined sensors:

##  START TIME ###################################################################
- platform: template
  sensors:
    timer_1_start_time:
      friendly_name: "Start Time"
      value_template: >-
        {{ "%0.02d:%0.02d" | format(states("input_number.timer_1_start_hour") | int, states("input_number.timer_1_start_minutes") | int) }}

##  FINISH TIME #################################################################
- platform: template
  sensors:
    timer_1_finish_time:
      friendly_name: "Finish Time"
      value_template: >-
        {{ "%0.02d:%0.02d" | format(states("input_number.timer_1_finish_hour") | int, states("input_number.timer_1_finish_minutes") | int) }}

This is the automation i have tried, however i cant get it to work, it just wont trigger:

- id: "1769202750885"
  alias: Timer 1 Finish Time
  description: ""
  trigger:
    - platform: time
      at: sensor.timer_1_finish_time
  condition:
    - condition: template
      value_template: "{{ is_state('input_boolean.timer_1_' ~ ['mon','tue','wed','thu','fri','sat','sun'][now().weekday()], 'on') }}"
  action:
    - service: light.turn_off
      target:
        entity_id:
          - light.kuche_1
      data: {}
  mode: single

The sensor state contains the right time, as can be seen in this picture:

i really dont know what could be the problem here, any help would be appreciated. Thank you!

Your sensor needs to be a timestamp sensor, and it needs to have a isoformatted time as the state.

- platform: template
  sensors:
    timer_1_start_time:
      friendly_name: "Start Time"
      device_class: timestamp
      value_template: >
        {% set entities = "input_number.timer_1_start_hour", "input_number.timer_1_start_minutes" %}
        {{ today_at(entities | map('states') | map('int') | list | join(":")) }}

- platform: template
  sensors:
    timer_1_finish_time:
      friendly_name: "Finish Time"
      device_class: timestamp
      value_template: >
        {% set entities = "input_number.timer_1_finish_hour", "input_number.timer_1_finish_minutes" %}
        {{ today_at(entities | map('states') | map('int') | list | join(":")) }}

I tried to apply your suggested change, however it doesnt quite work. The only change i see is that the time in the frontend is now “unavailable”

The automation still does not start.

paste the template into the template editor or look for errors in your logs. The templates work on my end.

i wrote the sensors in a seperate file and added it to configuration.yaml with this line:

sensor: !include sensor.yaml

do you want me to delete my existing sensors and replace them with the ones you provided?

Yes, you have to do that. You can’t have 2 slugs with the same name.

Oh yes, now it works just fine! Thank you so much!!