Designing an energy management system for smart houses