The present invention refers to a device in connection with an inhaler intended for measuring and recording the course of inhalation of a patient. The device is intended for use in medication, e.g. clinical tests, where there is a need of afterwards being able to control if the patient has taken medicine in a prescribed way. The device comprises an electronic unit provided in the inhaler for recording of the time for each dosage of the medicine of the inhaler. A detector (16,32,36) is provided in the inhaler in connection with a passage for the airflow of inhalation, whereby the detector detects the airflow of the inhalation through the inhaler as well as the availability of the medicine at the inhalation within said passage, so that a combination of these two detected values decides if and how the performed inhalation should be recorded in the electronical unit (11,33,35).