Author Topic: My website and Weatherlink IP, help me!  (Read 258 times)

0 Members and 1 Guest are viewing this topic.

Online sheldon

  • Member
  • *
  • Posts: 6
My website and Weatherlink IP, help me!
« on: October 24, 2014, 07:39:10 PM »
Hi, guys, I'm from Italy! (I apologize by now for my English)

I am having some problems for making my website for my Davis Vantage Vue Station, because I'm using Weatherlink IP.
First, I would like to know if a pre-compiled weather template exists for it (I'm not so good in making website pages), this could resolve all my problems.
If it doesn't exist, can you look at this code and tell me what is wrong?
The problem is that it shows on the webpage only some variables and not all. For example, temperature, relative humidity, wind speed, wind direction, are showed, while all the other variables aren't, even if in the code I defined them in the same way.
Code: [Select]
<?php
$url 
"http://www.weatherlink.com/xml.php?user=romaeur&pass=***";
$ip = @file_get_contents($url);
$object simplexml_load_string($ip);
$davis_current $cur_obs->davis_current_observation;
$cur_obs simplexml_load_string($ip);
$xml simplexml_load_file('http://www.weatherlink.com/xml.php?user=romaeur&pass=***');
foreach(
$object->temp_day_high_f as $tmaxf);
$tmax round(5/9*($tmaxf+32),1); 
foreach(
$xml->temp_day_low_f as $tminf);
$tmin round(5/9*($tminf+32),1); 
$objum simplexml_load_string($ip);


foreach(
$cur_obs->relative_humidity_day_high as $hummax);


foreach(
$xml->relative_humidity_day_low as $hummin);




foreach(
$xml->temp_day_high_time as $tmaxh);
foreach(
$xml->relative_humidity as $hum);
foreach(
$object->temp_c as $temp);
foreach(
$xml->heat_index_c as $heat);
foreach(
$xml->observation_time as $ultimo_aggiornamento);
foreach(
$xml->temp_day_high_f as $max);
foreach(
$xml->wind_kt as $velventos);
$velvento round($velventos 1.85,1);
foreach(
$xml->wind_dir as $dirvento);
foreach(
$xml->wind_degrees as $grvento);
foreach(
$xml->pressure_mb as $press);
foreach(
$xml->windchill_c as $chill);
?>

<?php
foreach($xml->rain_day_in as $prec);
foreach(
$xml->rain_rate_in_per_hr as $rrate);

foreach(
$xml->temp_day_low_time as $tminh);
foreach(
$xml->pressure_day_high_in as $pressmax);
foreach(
$xml->pressure_day_high_time as $pressmaxh);
foreach(
$xml->pressure_day_low_time as $pressminh);
foreach(
$xml->pressure_day_low_in as $pressmin);

This is the web page
http://romaeurmeteo.it/home.php

I obviously didn't insert all the code but only the part with variables definition

Thank you very much

Offline dalecoy

  • Forecaster
  • *****
  • Posts: 4488
    • Lee's Summit, MO
Re: My website and Weatherlink IP, help me!
« Reply #1 on: October 24, 2014, 09:25:43 PM »
What sort of computer/system are you using?

If it's a Windows system, have you tried using the WeatherLink software?

Offline Cutty Sark Sailor

  • WxElement panel
  • Forecaster
  • *****
  • Posts: 1651
  • I Think!... Therefore, I'm in a mess... .
    • Twin Hollies Weather Center
Re: My website and Weatherlink IP, help me!
« Reply #2 on: October 24, 2014, 10:25:02 PM »
Hello, Sheldon... Been using Vue + Weatherlink IP with VWS for over 4 Years, with Ken's Saratoga templates....
what could be simpler?

Mike




   Blitzortung 689


Online sheldon

  • Member
  • *
  • Posts: 6
Re: My website and Weatherlink IP, help me!
« Reply #3 on: October 25, 2014, 04:07:52 AM »
The problem is that I bought Weatherlink IP for not using a pc to send my data on a website. I want to avoid it!
And the only way to make up a personal website with my live data is to create it by getting them from my personal page on Weatherlink.com, where automatically the Weatherlink IP hardware sends the data!

Online sheldon

  • Member
  • *
  • Posts: 6
Re: My website and Weatherlink IP, help me!
« Reply #4 on: October 25, 2014, 04:08:04 AM »
The problem is that I bought Weatherlink IP for not using a pc to send my data on a website. I want to avoid it!
And the only way to make up a personal website with my live data is to create it by getting them from my personal page on Weatherlink.com, where automatically the Weatherlink IP hardware sends the data!

Online wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 317
    • Support site Leuven Template and scripts
Re: My website and Weatherlink IP, help me!
« Reply #5 on: October 25, 2014, 05:15:56 AM »
Hi, guys, I'm from Italy! (I apologize by now for my English)

I am having some problems for making my website for my Davis Vantage Vue Station, because I'm using Weatherlink IP.
First, I would like to know if a pre-compiled weather template exists for it (I'm not so good in making website pages), this could resolve all my problems.
If it doesn't exist, can you look at this code and tell me what is wrong?
The problem is that it shows on the webpage only some variables and not all. For example, temperature, relative humidity, wind speed, wind direction, are showed, while all the other variables aren't, even if in the code I defined them in the same way.

. . . shortened . . .

I obviously didn't insert all the code but only the part with variables definition

Thank you very much
There are two parts in the xml.
The first part with, in general,  the recent fields.
The second part which is contained in the firts part has mostly min/max measurements and date time fileds.
So
$xml = your weatherlink.com xml
With $xml -> field name you address fields as temp_c
With $xml -> davis_current_observation -> field name you address fields as temp_day_high_f

Important: In the first part the fields have metric (C) and imperial (F) as unit of measurement.
The second part has only imperial fields. You have to write conversion instructions for in to mm and F to C.

I enclosed a small example program which will display:
We can use for the fileds in the second part:
Pressmax using the long way : 30.061
Pressmax using the short way: 30.061

some xml fields:  mostly current ones form the first part
$dirvento     = Southwest
$press        = 1018.0

some obs fields: mostly high lows and time
$pressmax     = 30.061
$pressmaxh    = 6:40pm
Meteohub / Meteobridge with Vantage Pro2 UV Solar Soil Leaf
www.weerstation-wilsele.be   and   www.weerstation-herent.be
WeatherDisplay Cumulus Weatherlink using VVP and WeatherCat on a Mac Mini for development
www.weerstation-leuven.be

Online wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 317
    • Support site Leuven Template and scripts
Re: My website and Weatherlink IP, help me!
« Reply #6 on: October 25, 2014, 05:23:32 AM »
The problem is that I bought Weatherlink IP for not using a pc to send my data on a website. I want to avoid it!
And the only way to make up a personal website with my live data is to create it by getting them from my personal page on Weatherlink.com, where automatically the Weatherlink IP hardware sends the data!
In my other post I adressed your question about the fields in the xml.

Just one question on top:
Why do you do it the difficult way?

You do not want a full-blown PC 24/24 to send data to your own website.
But for less then 100 euro you could by a device such as metebridge and upload your data to Weatherlink.com with the WLIP you already have  AND
upload the data in the format you want to your website using the meteobridge .

And the electricity used is far less then the smallest PC you can imagine. No manual upgrades,  install and forget it.

You could then use the Saratoga- or Leuven-template as a starting point.
And / or you could also develop your own pages.

But the weather device (be it a meteobridge or a raspberryPI or whatever) can give you far more data then the WL.com xml.

Wim

« Last Edit: October 25, 2014, 05:31:56 AM by wvdkuil »
Meteohub / Meteobridge with Vantage Pro2 UV Solar Soil Leaf
www.weerstation-wilsele.be   and   www.weerstation-herent.be
WeatherDisplay Cumulus Weatherlink using VVP and WeatherCat on a Mac Mini for development
www.weerstation-leuven.be

Online sheldon

  • Member
  • *
  • Posts: 6
Re: My website and Weatherlink IP, help me!
« Reply #7 on: October 25, 2014, 01:17:57 PM »
The problem is that I bought Weatherlink IP for not using a pc to send my data on a website. I want to avoid it!
And the only way to make up a personal website with my live data is to create it by getting them from my personal page on Weatherlink.com, where automatically the Weatherlink IP hardware sends the data!
In my other post I adressed your question about the fields in the xml.

Just one question on top:
Why do you do it the difficult way?

You do not want a full-blown PC 24/24 to send data to your own website.
But for less then 100 euro you could by a device such as metebridge and upload your data to Weatherlink.com with the WLIP you already have  AND
upload the data in the format you want to your website using the meteobridge .

And the electricity used is far less then the smallest PC you can imagine. No manual upgrades,  install and forget it.

You could then use the Saratoga- or Leuven-template as a starting point.
And / or you could also develop your own pages.

But the weather device (be it a meteobridge or a raspberryPI or whatever) can give you far more data then the WL.com xml.

Wim

I didn't know about this, but for now I can't spend other money (the weather station and the datalogger had their price).
I saw a lot of cute websites realized by getting the data from the weatherlink.com xml, and I was wondering if someone had created a template for weatherlink IP users, which defines the variables and has a good graphic interface.
Otherwise, I have to create my webpage by the codes.

Anyway, thank you very much for telling me how to get the data that I couldn't insert in my page!!
Now it is working, I just have some problems with the conversions, because some values don't correspond exactly to the ones are showed on the weatherlink.com page.

Online wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 317
    • Support site Leuven Template and scripts
Re: My website and Weatherlink IP, help me!
« Reply #8 on: October 25, 2014, 02:05:42 PM »

. . . shortened . . .  I just have some problems with the conversions, because some values don't correspond exactly to the ones are showed on the weatherlink.com page.
In the first part (the point-measurements = the current values) of the xml there are metric (mm, C, mb)  and imperial (in, mph) values available.

In the second part (the min max per day month and so on) there are only imperial measurements.
So wind in mph, temp in F and the dates are in AM/PM.

The units in the xml are for general use. The way they are displayed on WeatherLink.com is done by your settings, or other visitors settings  on Weatherlink.com
 
Succes, Wim
Meteohub / Meteobridge with Vantage Pro2 UV Solar Soil Leaf
www.weerstation-wilsele.be   and   www.weerstation-herent.be
WeatherDisplay Cumulus Weatherlink using VVP and WeatherCat on a Mac Mini for development
www.weerstation-leuven.be

Offline dalecoy

  • Forecaster
  • *****
  • Posts: 4488
    • Lee's Summit, MO
Re: My website and Weatherlink IP, help me!
« Reply #9 on: October 25, 2014, 02:09:25 PM »
Your weather page at http://www.romaeurmeteo.it/home.php

would be much more useful if it included the date and time of the last update.

Online sheldon

  • Member
  • *
  • Posts: 6
Re: My website and Weatherlink IP, help me!
« Reply #10 on: October 25, 2014, 06:50:29 PM »

. . . shortened . . .  I just have some problems with the conversions, because some values don't correspond exactly to the ones are showed on the weatherlink.com page.
In the first part (the point-measurements = the current values) of the xml there are metric (mm, C, mb)  and imperial (in, mph) values available.

In the second part (the min max per day month and so on) there are only imperial measurements.
So wind in mph, temp in F and the dates are in AM/PM.

The units in the xml are for general use. The way they are displayed on WeatherLink.com is done by your settings, or other visitors settings  on Weatherlink.com
 
Succes, Wim

To solve this problem I provided a conversion code in the php file as follows:

Code: [Select]
foreach($xml->davis_current_observation->temp_day_low_f as $tminf);
foreach($xml->davis_current_observation->temp_day_high_f as $tmaxf);
$tmax = round((5/9) * ($tmaxf - 32),1);
$tmin = round((5/9) * ($tminf - 32),1);

but it doesn't give a satisfactory result, infact the values are not exactly the same. Look at the following two screens, the first by my website, the second from weatherlink.com page:

(In the meanwhile I changed my home's aspect:
http://romaeurmeteo.it/index.php/


Online sheldon

  • Member
  • *
  • Posts: 6
Re: My website and Weatherlink IP, help me!
« Reply #11 on: Today at 07:23:17 AM »
Can anybody help me?

Online wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 317
    • Support site Leuven Template and scripts
Re: My website and Weatherlink IP, help me!
« Reply #12 on: Today at 08:35:47 AM »
Can anybody help me?
The problem is that it is somewhere in your code, but nobody else but you can look into that code.
PHP is executed on the webserver into =>HTML, which is then send => to the browser.
So we only see the results. Not the code.
And we have no access to your xml to check what is going into the PHP.

=== Other WL.com scripts have no problem
I have my own Weatherlink.com template scripts:
http://www.weerstation-leuven.be/weatherWLC/
Remark: The test-site runs for a website in Vancouver Canada so the "last updated" times are recalculated for Vancouver timezone but the xml is recent for Leuven-time.

The xml from my station in Leuven is used:
http://www.weatherlink.com/user/wvdkuil/index.php?view=summary&headers=1
There are no differences between the WL.com xml and the converted values to metric.  Neither on WL.com as on my site.

This script is used to read the xml, convert it to needed UOMs (unit of measurent - C F and so on.) and cache the result for reuse if a next request is arriving very fast.
http://www.weerstation-leuven.be/weatherWLC/uploadXX/tagsWLCOM.php?sce=view

=== Add debug / test code
As with most scripts, at least 20% of the code of the scripts above is debugging code to understand what is going on.

What you should do to tackle the problem:
1. Load one xml file and put that in a local file on your webserver.
You are going to use that file to test until you are satisfied.
Also later on when you change something in your scripts you should use that test-file first.
2. Change te loading procedure with a setting to either load the xml form WL.com (using userid and password) or from the local test-file. Use a setting default to false, only when you change it to true the test is
3. Use a few extra lines around the fields with the error.
if ($test) {
echo <pre>.PHP_EOL;
echo $your xml filed before any conversion.' - '.$your field after conversion.PHP_EOL;
}

=== your remark:   in fact the values are not exactly the same

This can have many reasons, and again without the code it is only guessing:
Is the conversion routine wrong:
Are some fields correct  -or-  are they all in error?

Did you make a typo when copying:
Did you put the conversion in a function- or- did you copy it multiple times?

A simple programming error;
Same fieldname used on multiple locations?

=== Give us some info to help you.
Many people on this forum want to help. But without the php.code and the xml we can not do anything.
It would be wise to first make a small script which converts (parts of)  the xml and separate that from your web-page.
Than  you can post that script and the test xml so we can take a look.

Wim
« Last Edit: Today at 08:37:49 AM by wvdkuil »
Meteohub / Meteobridge with Vantage Pro2 UV Solar Soil Leaf
www.weerstation-wilsele.be   and   www.weerstation-herent.be
WeatherDisplay Cumulus Weatherlink using VVP and WeatherCat on a Mac Mini for development
www.weerstation-leuven.be