[HELP]Automation with lambda

Hello

Is it possible to control lambda functions if used natively in esphome template / config ?

I want to turn on relay when motion is detected and turn off after specific interval once motion is clear
it works perfectly but now i also want to turn on relay manually and turn of manually via home assistant

I know if i had created automation with home assistant then i could control it easily but not sure about esp home so just want to know about that

esphome:

  name: washbasin
  platform: ESP8266
  board: d1_mini

wifi:
  ssid: "ap"
  password: "pass"
  
# Enable logging
logger:

api:

ota:

binary_sensor:
  - platform: gpio
    id: motion
    name: "Washbasin Motion Sensor"
    pin:
      number: 16
      inverted: false
      mode: INPUT_PULLDOWN_16
    device_class: motion
    filters:
      - delayed_off: 5s
    on_press:
        - switch.turn_on: Relay

  - platform: template
    id: temp_motion
    lambda: 'return id(motion).state;'
    filters:
      - delayed_off: 1min
    on_release:
      - switch.turn_off: Relay

switch:
  - platform: gpio
    id: Relay
    name: "Relay"
    pin: 2
    inverted: false

now when i turn Relay on and if motion is detected it will turn off Relay once motion is cleared

If i had did same automation with home assistant then i could create a helper button and use it to toggle Relay
something like this

-motion detected
 *condition*
 input_boolean.relay - off // helper 
 then
 turn on relay
 delay
 turn off relay

please guide me if any option is available