Template trigger based on time - cannot make it work

Hi,
I have on light which i would like to turn on regarding to sunset. Maybe it is not crucial in this one, but for future automations i would like to have slider to be able to easly offset turnig on my light. So I have :

slider

slider_start_swiatla_lozko_min:
name: "offset start: "
min: -180 # values irrelevant right now
max: -100
step: 1
icon: mdi:camera-timer

template sensor

podswietlenie_lozka_start:
friendly_name: “Podświetlenie - start :”
entity_id:
- sun.sun
- input_slider.slider_start_swiatla_lozko_min
value_template: ‘{{ (as_timestamp(states.sun.sun.attributes.next_setting) + (states.input_slider.slider_start_swiatla_lozko_min.state | int * 60)) | timestamp_custom(“%H:%M”) }}’

automation

  • action:
    • data:
      entity_id: light.podswietlenie_lozka
      service: light.turn_on
      alias: “Podświetlenie łóżka - start”
      id: ‘201706171434’
      trigger:
    • platform: template
      value_template: ‘{{ as_timestamp(states.sensor.podswietlenie_lozka_start.state) == as_timestamp(states.sensor.time) }}’

I have my sensor.time and my template_sensor the same type ( i suppose) - they print same outputs in dev cart of my HA. Beside that my light is not turned on. Somehow i manag to turn it on once or twice, bu then after moving the slider, so setting different “on time” it wouldn’t turn on for the second time. I tried to copy lots of code given on this forum, yet my very easy automation will not work. What am i doing wrong ?