How to get yesterday's weather data?

Discussion of the Meteohub software package

Moderator: Mattk

Post Reply
cbhiii
Gold Boarder
Gold Boarder
Posts: 306
Joined: Fri Feb 15, 2008 2:02 am
Location: Michigan, USA
Contact:

How to get yesterday's weather data?

Post by cbhiii »

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!
Station: Davis Vantage Pro2 Plus
Hardware: Raspberry Pi 2 (Meteohub status)
sevenless
Gold Boarder
Gold Boarder
Posts: 160
Joined: Wed Jul 02, 2008 7:35 pm
Location: Seattle WA, USA

Re:How to get yesterday's weather data?

Post by sevenless »

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.
cbhiii
Gold Boarder
Gold Boarder
Posts: 306
Joined: Fri Feb 15, 2008 2:02 am
Location: Michigan, USA
Contact:

Re:How to get yesterday's weather data?

Post by cbhiii »

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)
Post Reply