Do you have a more efficient/elegant way to deal with a front gate status and control?

Currently, I’m using an entity status for the input relay and a button for the output relay toggle:

Wat type entity you have? If its a cover, a tilecard can make it little more convienient

You can combine the two buttons into one that shows the state and toggles the relay. This shows the state with changing icons and color, and displays the possible actions (Open or Close) based on the state of the input relay.

  - type: custom:button-card
    name: >
      [[[ if
      (states['binary_sensor.yourInputRelaySensor'].state ==
      'off') 
           return 'OPEN'; 
           else return 'CLOSE'; ]]]  
    show_name: true
    entity: switch.yourGateRelaySwitchEntity
    show_icon: true
    size: 50px
    icon: >
      [[[ if
      (states['binary_sensor.yourInputRelaySensor'].state ==
      'off') 
           return 'mdi:gate'; 
           else return 'mdi:gate-open'; ]]]      
    styles:
      card:
        - height: 60px
        - padding: 0px
        - border-radius: 10px
        - background: lightgrey
        - box-shadow: none
        - color: black
    state:
      - value: "off"
        color: black
      - value: "on"
        color: red
    tap_action:
      action: toggle

Thanks for responding so quickly! I’ve changed custom:button-card to be just button and the sensors and relays to be my IDs but perhaps there is something wrong when pasting YAML into HA (formatting?).

I’m on rubbish wifi on a plane and my HA MacOS app wont copy/paste so apologies for the screenshot:

You don’t need the “{” and “}” brackets in the code. Try to remove these.