Aging population is a worldwide trend, which has created a societal crisis as many countries face the challenges of supporting an aging population with increasing costs of healthcare and decreasing numbers of caregivers. Sleep related disorders are common diseases, especially among the elderly. In this paper, we propose a simple and affordable unobtrusive sensing environment including a high-sensitive accelerometer on a bed and passive infrared (PIR) motion sensors in every room, following the generic framework of Internet of Health Things (IoHT) for monitoring the elderly's sleep-wake conditions, to assess their sleep quality. The environment is nonintrusive, comfortable and can be used for long-term sleep monitoring, detecting early symptoms of sleep related disorders, and responding to caregivers. We implement and pilot test the environment under different daily living situations related to sleep quality. We develop a feature extraction algorithm and applied five popular data analytics models to assess their relative performance. Our study shows that all classifiers except Naïve Bayes can effectively detect sleep quality with the Area under ROC curve (AUC) performance higher than 90%. Among which multilayer feed-forward neural network achieved the best results, in which the detecting sensitivity is up to 96.61%, specificity is 91.81% and AUC performance is 94.21%.