A distributed sensing system for monitoring energy consumption and air quality in buildings