A portable unit for providing automated delivery of medication to a ventilator circuit that runs between a mechanical ventilator and a patient is provided. The portable unit includes: a housing configured to releasably hold an inhaler containing the medication, wherein the inhaler is in fluid communication with the ventilator circuit an actuator at least partially in the housing and in communication with the inhaler to deliver medication from the inhaler to the ventilator circuit for a respective patient a controller programmed to control an amount and/or frequency of medication delivery from the inhaler to the ventilator circuit for a respective patient, the controller configured to actuate the actuator to deliver the medication from the inhaler to the ventilator circuit at the programmed amount and/or frequency and a display for displaying the amount and/or frequency of medication delivery and an amount of medication remaining in the inhaler, wherein the display is dynamically updated by the controller. Diagnostic devices are also disclosed that: 1) administer an agent to gas to be inhaled 2) detect/measure exhaled gas and/or 3) determine a state or condition of a patient based on the detected/measured exhaled gas.