How would I automate a timer between specified hours with on/off switch?

For those that need it, and the input_datetime includes date and time, the calculation may be performed using timestamps:

          value_template: >
            {{ state_attr('input_datetime.programme_timer_1_on', 'timestamp') 
               <=  now().timestamp() <=  
               state_attr('input_datetime.programme_timer_1_off', 'timestamp') 
               and is_state('input_boolean.programme_1_enabled', 'on') }}
2 Likes