Input datetime in esphome

Hello, i´m new here and have a question.

i would like to start and stop a pump with my esphome divice
and i check the state of the pump for every 5 sec

            - if:      
              condition:
                      - lambda: 'return id(ha_time).now().hour >= 10 and id(ha_time).now().hour < 18;'
              then:
               switch.turn_on: pump
              else:
               switch.turn_off: pump

that works good

now, i want take two helpers, one for a beginning time and one for endtime
how i can do this? i have no idea and i have no found

many thanks for a help