History and prediction for IoT