"Message malformed: Invalid time specified" - Newbe need Help with script

Hi everyone, i’m tring to do my first script.

I’m creating a time field

time_start:
  selector:
    time: {}
  name: Time start
  description: "Inserisci il limite orario di inizio"
  required: true

and i’m tring to use it in a condition based on time

if:
  - condition: time
    after: "{{ time_start }}"
    before: "{{ time_end }}"
then:
  - service: timer.start
    metadata: {}
    data: {}
    target:
      entity_id: "{{ timer_entity }}"
enabled: true

but i try to save the script i keep geting this error message:

Message malformed: Invalid time specified: {{ time_start }} for dictionary value @ data[‘sequence’][0][‘if’][0][‘after’]

This is all the script:

alias: "Timer: start timer on time condition"
sequence:
  - if:
      - condition: time
        after: "{{ time_start }}"
        before: "{{ time_end }}"
    then:
      - service: timer.start
        metadata: {}
        data: {}
        target:
          entity_id: "{{ timer_entity }}"
    enabled: true
fields:
  time_start:
    selector:
      time: {}
    name: Time start
    description: Inserisci il limite orario di inizio
    required: true
  time_end:
    selector:
      time: {}
    description: Inserisci il limite orario di fine
    name: Time end
    required: true
  timer_entity:
    selector:
      entity:
        multiple: false
    name: Timer entity
    description: Entità del timer
    required: true
description: Fa partire un timer se si trova in quell'intervallo di tempo
icon: mdi:clock-time-eight-outline

whot i’m doing wrong?

You can’t template every field in home assistant. Typically the only fields you can template throughout HA are fields that indicate it with _template in the name. There are exceptions to this though. It’s always best to just consult the documentation.

To do that condition, you need to use a full template.

- condition: template
  value_template: "{{ today_at(time_start) < now() < today_at(time_end) }}"

Thanks petro, I’ve never heard of the term template, i just did some automations, and i was tring to expand them with some scripts. Can you link to me some documentation about template, and how to integrate it with script or(aned automation.

These are templates

oh, thank you very much!