ESPHome - deep sleep on demand

I am working on a solar powered irrigation controller - hardware wise I have it all working fine but I am struggling little bit with esphome and deep sleep. This is what I have so far:

deep_sleep: 
  id: deep_sleep_1

time:
  - platform: homeassistant
    id: homeassistant_time
    on_time:
      #Deep sleep at 8pm and wake up at 6am.
      - hours: 20
        then:
        - deep_sleep.enter:
            id: deep_sleep_1
            until: "06:00:00"
            time_id: homeassistant_time

this works great and the device goes to sleep everyday at 8PM and wakes up at 6AM. I would like to add option to send the device to sleep on demand in a form of a switch - is that possible?
Thanks

Just define your switch and then call deep_sleep.enter.
If you just have one deep_sleep definition, you even do not need to specify the id.

switch:
  - platform: gpio  # or any other platform
    # ...
    on_turn_on:
      - deep_sleep.enter: deep_sleep_1