Refactor the api fetchSensorValue method to accept from/to parameters
and make sure that the fetch previous button only takes effect once.