Smart management of energy and building performance