How to change button icon based on state

I’m using a button card to show the state of my garage doors using a binary sensor mounted on the door. Is there a way that the card will show the hass:garage icon when the door is closed and the hass:garage-open when the door is open?

Here is my code for the button currently.

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: switch.turn_on
  target:
    entity_id: switch.big_garage_door
  data: {}
entity: binary_sensor.big_garage_door
show_state: true
icon_height: 60px

Apply the device class garage_door to your binary_sensor.big_garage_door configuration (not the card configuration).

Thanks, that did it!

I also had to remove the hass:garage icon from my entity settings for the binary sensor. I assume entering an icon on the entity settings overrides the device class.

Yes specifying an icon overrides the device class icon.