How to prevent a button from switching "off"?

I have an intense dislike of timers (I view them as unnecessary complexity), preferring to use the delay_on/off attributes of template binary sensors to achieve (almost **) the same result.

** - Timers are slightly better when HA restarts, but for most cases the difference isn't important enough to worry about (as others have stated using a delay inside an automation doesn't survive restarts, hence should be avoided).

Anyway, if we break the overall problem you are trying to solve into smaller parts we can solve each part separately:

#1 - The Pump Should Run for 3 Minutes.

Create a template binary sensor on the running state of the pump with a 3 minute delay_on:

- binary_sensor:
    - name: "Pump Running"
      unique_id: pump_running
      state: >
        {{ is_state("switch.pump", "on") }}
      delay_on:
        minutes: 3

Then create an automation triggered by the state of the TBS above, such that when the TBS switches on (3 minutes after the pump turns on), you turn off the pump.

mode: single
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.pump_running
    to:
      - "on"
conditions: []
actions:
  - action: switch.turn_off
    target:
      entity_id: switch.pump

#2 - Lockout the Pump for 30 minutes

30 minutes + the 3 minute runtime of the pump is 1,980 seconds.
So we just need an automation with a condition that prevents running for 1980 seconds.

mode: single
triggers:
   ... Whatever trigger conditions you have to start the pump

conditions:
  - condition: template
    value_template: >
      {{
        this.attributes.last_triggered is none or
        (now() - this.attributes.last_triggered).total_seconds() > 1980
      }}

actions:
  - action: switch.turn_on
    target:
      entity_id: switch.pump

#3 - Display Status

I am not an artistic person.
So I will say, follow the other contributors advice for how to display the current status.
You have two actual conditions you may want to display:

  • If the pump is currently running.
  • If the automation is still in lockout state (repeat the condition listed above).