Using input_number or input_datetime as offset in automation with sunset trigger

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: ""
  - platform: sun
    event: sunset
    offset: "00:{{ states('input_number.min') | int }}:{{ states('input_number.sec') | int }}
condition: []

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:

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

Does anybody know a solution?


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