Is settings state of cover in lambda possible?

Hi. Is it possible to set assumed_state to true or false in lambda? I am trying to enable both up and down buttons in case I stop my garage door opening at half, so I would like to have both buttons enabled to have a choice, either I continue opening the garage, or close it. At the moment, if I start opening garage door and stop it mid way, I have to press again “Open cover” to open it fully, only then the “Close cover” button gets enabled.

cover:
  - platform: template
    device_class: garage
    id: cover_garage
    name: Mercedes
    lambda: |-
      if(id(bottomSensor).state < 0.25) {
        return COVER_CLOSED; 
      }  
      else if(id(topSensor).state < 0.25) {
        return COVER_OPEN;
      }
      else if(isnan(id(bottomSensor).state) && isnan(id(topSensor).state))
      {
       id(cover_garage).assumed_state(true);
      }
      else {
        id(cover_garage).assumed_state(false);
      }
    open_action:
      - switch.turn_off: open_switch
    close_action:
      - switch.turn_off: close_switch
    stop_action:
      - switch.turn_on: close_switch
      - switch.turn_on: open_switch