How to set a pump to 70% power in a switch in ESPHome?

I’m working on a project using ESPHome to control a pump. I have a switch (calibration_switch_70) that I use to initiate a calibration process. During this process, I would like to set the pump’s speed to 70% of its maximum power. Can anyone help me with the code or configuration to achieve this within the ESPHome framework?

Thank you in advance for your assistance!

This is my code for the switch:

# Switches for autotune, calibration and correction
  - platform: gpio
    pin: GPIO13
    id: calibration_switch_70
    name: "Calibration_70"
      # Start the calibration process
      - lambda: |-
          static float sum70 = 0.0;
          static int num_measurements = 0;

          while (num_measurements < 60) {
            sum70 += id(flow_sensor).state;
            delay(1000); // Delay 1 second between measurements
          float averaged_flow_70 = sum70 / 60;
          float Raw_70 = id(measure_70);

          float Reference_30 = id(flow_30);
          float Raw_30 = id(measure_30);

          float RawRange = 0.0;
          float ReferenceRange = 0.0;

          RawRange = Raw_70 - Raw_30;
          ReferenceRange = averaged_flow_70 - Reference_30;

          id(RawRange_G1) = RawRange;
          id(ReferenceRange_G2) = ReferenceRange;
          id(measure_30) = Raw_30;

Are you using PWM (LEDC) output to pulse the pump ?