How can I query the output?

i have here a normal output:

      - type: horizontal-stack
        cards:
          - type: 'custom:button-card'
            template: card_graph
            entity: sensor.tankerkoenig_ed_tank_diesel
            variables:
              ulm_card_graph_color: "var(--google-blue)"
              ulm_card_graph_name: ED Tankstelle
              ulm_card_graph_entity: sensor.tankerkoenig_ed_tank_diesel
              ulm_card_graph_type: fill
              ulm_card_graph_hours: 72
              ulm_card_graph_group_by: interval

but the gas-station have a closing time.
if there is closed, the state from sensor.tankerkoenig_ed_tank_diesel is “unknown”
now i need a other text like: close

this sensor give me the info open or close:
binary_sensor.tankerkoenig_ed_tank_status = on / off

can i create such an output with a query?

- type: horizontal-stack
        cards:

IF:
binary_sensor.tankerkoenig_ed_tank_status = off

THEN:
- type: 'custom:button-card'
            template: test

ELSE:
- type: 'custom:button-card'
            template: card_graph
            entity: sensor.tankerkoenig_ed_tank_diesel
            variables:
              ulm_card_graph_color: "var(--google-blue)"
              ulm_card_graph_name: ED Tankstelle
              ulm_card_graph_entity: sensor.tankerkoenig_ed_tank_diesel
              ulm_card_graph_type: fill
              ulm_card_graph_hours: 72
              ulm_card_graph_group_by: interval

i hope you can help me.

sound like good. I will check it!