Using input_number or input_datetime as offset in automation with sunset trigger

Hi,
I want to use an input_number / input_datetime, to edit the offset time of the sunset trigger in an automation. Like in my example:

alias: turn_on_light
description: ""
trigger:
  - platform: sun
    event: sunset
    offset: "00:{{ states('input_number.min') | int }}:{{ states('input_number.sec') | int }}
condition: []
action:
.......

But I get this error:
Message malformed: offset 00:{{ states(‘input_number.min’) | int }}:{{ states(‘input_number.sec’) | int }} should be format ‘HH:MM’, ‘HH:MM:SS’ or ‘HH:MM:SS.F’ for dictionary value @ data[‘offset’]

I found this code example in the docs:

automation:
 - alias: "turn something off after x time after turning it on"
   trigger:
     platform: state
     entity_id: switch.something
     to: "on"
   action:
     - delay: "00:{{ states('input_number.minutes') | int }}:{{ states('input_number.seconds') | int }}"
     - service: switch.turn_off
       target:
         entity_id: switch.something

Does anybody know a solution?

Thanks

The Sun Trigger’s offset option doesn’t support templates.

So is there another way to implement this offset?

What’s the intended application for offsetting sunset by a variable amount of time?

I want control this offset variable via the dashboard. So the user can edit the switch point of lights if its nessesary because if winter, summer sun deviation etc.

The recommended way of compensating for seasonal variance is to use the sun’s elevation as opposed to a time-based offset.

Reference: Sun Elevation Trigger

Ok thany you, I will try that