Function ambient_weather_api::get_historic_device_data
source · pub fn get_historic_device_data(
api_credentials: &AmbientWeatherAPICredentials
) -> Vec<WeatherData>
Expand description
Gets the historic device data from the Ambient Weather API.
As of version 0.3.0 this now functions in an asynchronous manner.
In order to use this API, you will need to look over the list of device parameters that Ambient Weather offers. Not all device parameters may be used, so make sure you are calling one that is associated with your device.
Examples
use ambient_weather_api::*;
fn main() {
let api_credentials = AmbientWeatherAPICredentials {
api_key: String::from("Your API Key"),
app_key: String::from("Your Application Key"),
device_id: 0,
use_new_api_endpoint: false,
};
// Get the historic temperatures and loop through them going back in time
let historic_data = get_historic_device_data(&api_credentials);
for i in 0..historic_data.len() {
println!("The historic temp was: {}F", historic_data[i].tempf.unwrap());
}
}