Dashboard button, with conditional action?

I wonder if this is possible without an automation/script?

A dashboard button with a toggle action BUT: the action may not execute if another switch (entity) is on.
The conditional card could be a way around it, can it also be done as in my imagination?

I think the conditional card is the way to go - two identical button cards, one conditional on the switch being on, the other on it being off. Then in the “on” card, the tap action is disabled.

Edit: I’ve got one a bit like that which changes the name on the card (from “windows” to “window”:

  - type: vertical-stack
    cards: 
      - type: conditional
        conditions:
          - condition: state
            entity: binary_sensor.window_open
            state: "off"
        card:
          type: tile
          entity: binary_sensor.window_open
          name: Windows
          tap_action:
            action: none
          icon_tap_action:
            action: none
      - type: conditional
        conditions:
          - condition: state
            entity: binary_sensor.window_open
            state: "on"
        card:
          type: tile
          entity: binary_sensor.window_open
          name: Window
          color: red
          tap_action:
            action: none
          icon_tap_action:
            action: none
1 Like