User Activity Recognition for Energy Saving in Smart Homes