Smart inhaler for asthma patients