Condition template to execute between two times (input variables)

This is fantasic - thanks for all your help - Gotta say I’m a >bit< OCD when it comes to getting technology to work… when I get an idea and I want to figure it out… I’ll become a bit obsesed with finding a way - more about understanding how it works than the actual outcome sometimes (yes - I could just manually set an end time!)

Learnt a lot from this thread - hope I can help some other folks here too!

I’m reminded of Steve Jobs, refusing to accept a 37 second boot time on the first apple macs (he wanted 30 seconds) “but why ?” said the engineer. “it’s only 7 seconds” he replied “yes but 7 seconds multiplied by 2 boots per day, 5 days a week, 42 weeks a year, for 5 year lifespan and 120,000 users is years” - they got it down to 31 seconds I think.

hey @Mutt - I finally got the chance to implement your code sample with just a few tiny alternations - great to get this working and even better to have your example for my other code endevours!

# automate the end time based on the start time
- id: dynamic_grow_light_setting
  alias: Change in start time or grow_cycle - set new end time
  description: 'Set the end light time based on start time and growth cycle'
  trigger:
    - platform: state
      entity_id: input_select.growth_cycle
    - platform: state
      entity_id: input_datetime.grow_light_on
  action:
    - service: input_datetime.set_datetime
      data_template: 
        entity_id: input_datetime.grow_light_off
        time: >
          {% set strt = states('input_datetime.grow_light_on') %}
          {% set tsstrt = as_timestamp(now().strftime('%Y-%m-%d ' ~ strt)) %}
          {% set drtn = 12 if is_state('input_select.growth_cycle', 'Flower') else 18 %}
          {% set tsfnsh = tsstrt + (drtn * 60 * 60) %}
          {{ tsfnsh | timestamp_custom('%H:%M:00') }}

Cheers!

-=Lip