Need help with platform sun using event sunset with offset

Hello everyone and let me apologize immediatly being new to Home Assistant. I am having some difficulty with substituting an input slider value into the offset: parameter of the sun platform. What I want to do is vary the offset to turn lights on at sunset, this is my code snippet:
indent preformatted text by 4 spaces
- alias: Turn on house lights at Sunset

    - platform: sun
      event: 'sunset'
#      offset: '-00:{{states.input_slider.dusk_lights_on_offset.state | int}}'
      offset: '-00:45'

    - service: light.turn_on
      entity_id: group.family_room
    - service: light.turn_on
      entity_id: group.living_room
    - service: light.turn_on
      entity_id: group.exterior_lights

Note that the commented line is what’s causing me problems. This is what HA says about that line:

16-08-14 14:14:26 homeassistant.bootstrap: Invalid config for [automation]: offset 00:{{states.input_slider.dusk_lights_on_offset.state | int}} should be format ‘HH:MM’ or ‘HH:MM:SS’ for dictionary value @ data[‘trigger’][0][‘offset’] (See /home/pi/.homeassistant/automation.yaml:43)

When I use the template feature of HA to verify that the syntax is correct, it gives me this:

From the template window using this:
offset: ‘-00:{{states.input_slider.dusk_lights_on_offset.state | int}}’

  offset: '-00:30'

I am at a loss to understand what’s afoul.


you cant use templates for offset.

probably the better way is to make a template sensor.
in the template sensor you use the sunset en the input_slider to set the time.
and that template sensor can be used as trigger.
if you want to see the time, you have the sensor, if not you can hide the sensor in customize.