Automate user behavior to reduce energy demand and improve indoor air quality of residential buildings