Activity recognition and prediction in buildings can have multiple positive effects in buildings: improve elderly monitoring, detect intrusions, maximize energy savings and optimize occupant comfort. In this paper we apply human activity recognition by using data coming from a network of motion and door sensors distributed in a Smart Home environment. We use Hidden Markov Models (HMM) as the basis of a machine learning algorithm on data collected over an 8-month period from a single-occupant home available as part of the WSU CASAS Smart Home project. In the first implementation the HMM models 24 hours of activities and classifies them in 8 distinct activity categories with an accuracy rate of 84.6%. To improve the identification rate and to help detect potential abnormalities related with the duration of an activity (i.e. when certain activities last too much), we implement minimum duration modeling where the algorithm is forced to remain in a certain state for a specific amount of time. Two subsequent implementations of the minimum duration HMM (mean-based length modeling and quantile length modeling) yield a further 2% improvement of the identification rate. To predict the sequence of activities in the future, Artificial Neural Networks (ANN) are employed and identified activities clustered in 3 principal activity groups with an average accuracy rate of 71-77.5%, depending on the forecasting window. To explore the energy savings potential, we apply thermal dynamic simulations on buildings in central European climate for a period of 65 days during the winter and we obtain energy savings for space heating of up to 17% with 3-hour forecasting for two different types of buildings.