To set trigger conditions correctly in pneumatic mode, a ventilator is controlled to obtain a measurement value of a bioelectric signal representative of the patient's breathing function, determine, based on the bioelectric signal, at least one point in time at which the patient starts inhalation, obtain a measurement value to be used for triggering an inspiration phase in the ventilator during the at least one point in time, determine a trigger condition for the inspiration phase on the basis of the measurement value, and use the trigger condition for initiating inspiration when ventilating the patient in support mode.