Hi all,
On my webpage I display the current day's weather information. I also want to show yesterday's high and low temperature. How can I do this?
There does not seem to be any weather information for a variable such as "day2..." which would show this. Only "last24h" or "day1".
Thanks for any help with this!
How to get yesterday's weather data?
Moderator: Mattk
How to get yesterday's weather data?
Station: Davis Vantage Pro2 Plus
Hardware: Raspberry Pi 2 (Meteohub status)
Hardware: Raspberry Pi 2 (Meteohub status)
Re:How to get yesterday's weather data?
There are a few "sequential <time frame>" variables that you can use to retrieve this information.
For instance, for yesterday's high temperature you would use [seqday1_th0_tempmax_c@2] to retrieve yesterday's high temperature in Celsius. There's no sequential output in Fahrenheit (or any other non-metric measure for other sensors), so you'll need to use the {math} code to convert if you prefer that scale for your data.
Likewise for the minimum temperature use the above string but swap 'tempmin' for 'tempmax'.
There is a bit of information in the manual about parsing the data and doing math, under the section on Displaying Weather Data (section 3.4 in the old v3.1 manual.)
I don't think there's any discussion of the seqXXX variables, but if you check your all_sensor output you'll see a bunch of them for several time frames. The seqday1 output stores the last 30 days of weather data, as long strings separated by the underscore character.
For instance, for yesterday's high temperature you would use [seqday1_th0_tempmax_c@2] to retrieve yesterday's high temperature in Celsius. There's no sequential output in Fahrenheit (or any other non-metric measure for other sensors), so you'll need to use the {math} code to convert if you prefer that scale for your data.
Likewise for the minimum temperature use the above string but swap 'tempmin' for 'tempmax'.
There is a bit of information in the manual about parsing the data and doing math, under the section on Displaying Weather Data (section 3.4 in the old v3.1 manual.)
I don't think there's any discussion of the seqXXX variables, but if you check your all_sensor output you'll see a bunch of them for several time frames. The seqday1 output stores the last 30 days of weather data, as long strings separated by the underscore character.
Re:How to get yesterday's weather data?
Thanks for the tip. I didn't realize you could sample out part of those strings. I will try it and use the code below to convert from C to F. Thanks.
<script type="text/javascript">
var tc = "[seqday1_th0_tempmax_c@2]";
tf = Math.round(((1.8*tc)+32)*10)/10;
document.write(tf);
</script>
Station: Davis Vantage Pro2 Plus
Hardware: Raspberry Pi 2 (Meteohub status)
Hardware: Raspberry Pi 2 (Meteohub status)
