An accessory (40) for an inhaler (10) comprises a fastening structure (42) for fastening the accessory to the inhaler. The accessory has a pressure port (43). When the accessory is fastened to the inhaler, the pressure port is arranged upstream from a mixing zone (33) of the inhaler with respect to an air flow (Fl) caused by inhalation by a patient through the inhaler. An electronic sensor (45) is in communication with the pressure port. The electronic sensor is sensitive to a pressure change at the pressure port caused by the air flow.