(Manual) Input to set trigger time

I have the following problem. I have garden lights which switches on at sunset. So far so good. I want these to have turned off normally at say 23:15 (11.15 PM). But sometimes (say I am off to a party and know to arrive late or staying late in the garden when the weather is good, my daughter is arriving late etc) I want to have these turned off at another time (say 00:15). Prefarably I want it by changing a lovelace interface item.

So My normal script is:

- id: '1579681705000'
  alias: Buitenlicht uit om 23:15
  description: Zet de lichtslang uit om 23:15
  - at: '23:15'
    platform: time
  - condition: state
    entity_id: switch.stopcontact_buiten
    state: 'on'
  - entity_id: switch.stopcontact_buiten
    service: switch.turn_off
  - entity_id: light.tuinlichtjes_light
    service: light.turn_of

Now what I want is some input on my lovelace interface that preferably inputs time (like:

I have tried to replace the ‘23:15’ in the trigger with all kind of values but whatever I try it is not accepted as "good"code

I have tried to setup a time_patern and use inputs from this:

It is accepted as code but when reload automation it gives an int error.

For the time trigger I have tried this:

- at: '{{state_attr(''input_datetime.eindtijd_buitenlicht'',''hour'')|string}}:{{state_attr(''input_datetime.eindtijd_buitenlicht'',''hour'')|string}}'

and this:

- at: "{{states('input_datetime.eindtijd_buitenlicht')}}"

Based on an example I even tried something like this:

 - at: '{{ as_timestamp(strptime((states(''input_datetime.eindtijd_buitenlicht'')), ''%H:%M'')) | timestamp_custom(''%H:%M'') }}'

No results

Then I switched to time_patern and tried:

  - hours: '{{states(''input_number.uren_timer'')|int}}'
    minutes: '{{states(''input_number.minuten_timer'')|int}}'
    platform: time_pattern

The code is checked ok bij HA but reloading HA gives this error:

invalid literal for int() with base 10: '{'

I think I am out of examples but I probably have tried more.
Is it the case that the At: of time cannot handle something else then fixed hardcoded times?
Any one an idea how to fix my problem? Maybe a complete other view on the actual problem (setting a time manually to a value for exceptions on the normal time schedule)


Ok all, sometimes you have to admit that you are newbee, and for me this is the time. I search every bit of forum, reddit etc and could not find my solution. But it was already in the standaard Home Assistant pages. It is one of the examples on this page: Home assistant input_datetime.

I had to take 2 simple steps:

  1. Define time as a sensor in my config file (found in this manual: date_time object;
  2. Add a template trigger with value template where the time sensor is compared to the time setting of the datetime_input.

To show any one who;s intrested:

  #- at: '23:15'
  - value_template : "{{ states('sensor.time') == (state_attr('input_datetime.eindtijd_buitenlicht', 'timestamp') | int | timestamp_custom('%H:%M', False)) }}"
    platform: template