Code error/ help

Hello, i made a sketch awhile back for some smart blinds which works perfectly on the older version of ESPhome. however im setting up a homeassistant server for someone else and i want to use esphome again for blidns as i know it works well. the issue is they released a new version which wont allow me to use the same code. ive fixed most issues but this one thats left is out of my league as i dont know much about code. heres the error message and code.

binary_sensor:
  - platform: gpio
    pin: D3
    name: "Button"
    filters:
      invert:
    on_press:
      then:
        - lambda: |
            if (id(kitchen_window).state == cover::COVER_OPEN) {
              if (id(shade_s1).state){
                // shade is opening
                id(kitchen_window).make_call().set_command_stop();
              } else {
                // shade is open and not moving
                id(kitchen_window).make_call().set_command_close();
              }
            } else {
              if (id(shade_s2).state){
                // shade is closing
                id(kitchen_window).make_call().set_command_stop();
              } else {
                // shade is closed and not moving
                id(kitchen_window).make_call().set_command_open();
              }
            }

From the error it looks like id(kitchen_window) is a cover in which case
id(kitchen_window).state

should be

id(kitchen_window).position

An example from the ESPHome docs:

if (id(my_cover).position == COVER_OPEN) {
  // Cover is open
} else if (id(my_cover).position == COVER_CLOSED) {
  // Cover is closed
} else {
  // Cover is in-between open and closed
}