Calendar trigger with templated offset

Hi

Trying to do something like:

alias: caltest
trigger:
  - platform: calendar
    event: start
    offset: "-0:{{ states('input_number.preheat_mins')|int }}:0"
    entity_id: calendar.teszt
    id: arriving

but get

Message malformed: offset 0:{{ states('input_number.preheat_mins')|int }}:0 should be format 'HH:MM', 'HH:MM:SS' or 'HH:MM:SS.F' for dictionary value @ data['offset']

Apparently offset does not get template-evaluated? Is there any chance to make the offset depend on some variable or state?

Most triggers have no ability or very limited ability to use templating. The few places that you can use templates in triggers are detailed in the Automation Triggers doc (and they usually include an example specifically including a template).

AFAIK, there is currently no way to do what you are trying to do in your example.

A delay action might work for me. In an other automation I want to switch off HVAC after a calendar event finished, but with a (input_number) configurable delay.

I wanted to do the same thing : pre-heat a room before my client checks in.

Finally I added a delay before the action, starting from the longer pre-heat duration expected.

Trigger :

platform: calendar
event: start
offset: "-06:0:0"
entity_id: calendar.studio
id: Arrivée

Action:

choose:
  - conditions:
      - condition: trigger
        id:
          - Arrivée
    sequence:
      - if:
          - condition: numeric_state
            entity_id: sensor.wiser_lts_temperature_studio
            below: 19
        then:
          - delay: >-
              {{ 6-(( 20 -
              (states('sensor.wiser_lts_temperature_studio')|float(0))) / 2) |
              round(0) }}:0:0
      - service: switch.turn_off
        data: {}
        target:
          entity_id: switch.wiser_away_mode

I would have prefered a templated trigger… maybe in the future !