Convert Input_DateTime to remove seconds

Hi there,
Am trying to convert an input_datetime to remove the seconds but the sensor isn’t working. Any help would be much appreciated!

Tried this as a Template without success, sensor showing as “unknown”

  - sensor:
        name: Pool Pump On
        device_class: timestamp
        state: "{{ state_attr('input_datetime.pool_pump_on', 'timestamp') | timestamp_custom('%H:%M') }}"
        icon: "mdi:calendar-clock"
{{ state_attr('input_datetime.pool_pump_on', 'timestamp') | timestamp_custom('%H:%M', false) }}

Amazing, worked a treat, thanks so much!