How to change icon based on state in the minimalist cover card

Hi guys can someone please point me in the right direction.
I am trying change the curtain icon based on the state of the curtain

In the minimalist cover card usage page it give a usage example (see below)

- type: "custom:button-card"
  template: card_cover
  entity: cover.window
  variables:
    ulm_card_cover_enable_controls: true
    ulm_card_cover_enable_slider: true
    ulm_card_cover_color: "green"

Now by looking into the template there is a bit on icons so i am assuming it can be done easily (see below)

  type: "custom:button-card"
              entity: "[[[ return entity.entity_id ]]]"
              variables: >
                [[[
                  let vars = variables;
                  if (variables.ulm_card_cover_enable_popup) {
                      vars.ulm_custom_popup = {
                          'template': 'popup_cover'
                      };
                  }
                  return vars;
                ]]]
              icon: >
                [[[
                  var icon = entity.attributes.icon || "mdi:help-circle";
                  var icon_state = {
                    "open": "open",
                    "opening": "open",
                    "closed": "closed",
                    "closing": "closed"
                  };
                  if(entity.attributes?.device_class){
                    var device_class = entity.attributes?.device_class;
                  }
                  var icon_open = {
                    "awning": "mdi:window-open",
                    "blind": "mdi:blinds-open",
                    "curtain": "mdi:curtains",
                    "damper": "mdi:circle-outline",
                    "door": "mdi:door-open",
                    "garage": variables.ulm_card_cover_garage_large ? "mdi:garage-open-variant" : "mdi:garage-open",
                    "gate": "mdi:gate-open",
                    "shade": "mdi:roller-shade",
                    "shutter": "mdi:window-shutter-open",
                    "window": "mdi:window-open",
                  };
                  var icon_closed = {
                    "awning": "mdi:window-closed",
                    "blind": "mdi:blinds",
                    "curtain": "mdi:curtains-closed",
                    "damper": "mdi:circle-slice-8",
                    "door": "mdi:door-closed",
                    "garage": variables.ulm_card_cover_garage_large ? "mdi:garage-variant" : "mdi:garage",
                    "gate": "mdi:gate",
                    "shade": "mdi:roller-shade-closed",
                    "shutter": "mdi:window-shutter",
                    "window": "mdi:window-closed",
                  };
                  return variables.ulm_card_cover_icon || (icon_state[entity.state]=='open' ? icon_open[device_class] : icon_closed[device_class]) || icon
                ]]]

My question is how can i change the icon from a closed curtain to an open curtain based on the state?

I have tried a fair few option but all result in a blank icon or the ? icon.

Any guidance would be greatly appreciated