Author Topic: Advice needed please - GW1001  (Read 4615 times)

0 Members and 1 Guest are viewing this topic.

Offline droiddk

  • Forecaster
  • *****
  • Posts: 334
Re: Advice needed please - GW1001
« Reply #25 on: June 14, 2019, 01:24:12 AM »
Tried all the above but still not happening. Port 80 is definitely open and I've ene disabled the firewall on the server machine for now.

I've tried 3 laptopes and an Android phone and all can get to 192.168.1.100/weatherstation/updateweatherstation.php just fine and the file in the weatherstation folder in the root of the web server also updates.

I've tried with both the console and my gw1000 through WS view but neither seem to work.

Please post a screenshot of the "Customized" page in WS View.

Maybe a firewall-issue? My first tests was all blocked by webserver firewall - dont know why it did not like the console.

Regards

Offline WelshDragon

  • Member
  • *
  • Posts: 43
    • Tenby weather website
Re: Advice needed please - GW1001
« Reply #26 on: June 14, 2019, 01:56:20 AM »
Well this is strange. At about 3am it started working!

Only thing I can think of is it was something to do with the firmware update they released which also seemed to stop uploads to Wunderground for a few hrs.

Thanks for your help people - I can tags it from here. I think  [tup] #-o

Offline droiddk

  • Forecaster
  • *****
  • Posts: 334
Re: Advice needed please - GW1001
« Reply #27 on: June 14, 2019, 09:58:12 AM »
At about 3am it started working!


Great! Now you have the data, have fun   [tup]

Offline Thor72

  • Member
  • *
  • Posts: 4
Re: Advice needed please - GW1001
« Reply #28 on: September 23, 2019, 07:11:12 AM »
Good day,

hoping this topic is still alive  [tup]

@droiddk

Thanks for sharing your knowledge and the lines of code which helped me to get first pieces of data from my PWS.

:lol: :lol: Yeah I kind of thought it would be as easy as the code I had - that was from an example I saw when I started reading up on JSON earlier.

I'm not that bothered about getting it into Saratoga for now - just a formatted (xml, csv) type of file would be fine. Getting it into SQL/MariaDB would be great!

Point for trying!

Ok. Lets see where we can start.

On your server, 192.168.1.100, in home root, make a folder called "weatherstation" and place "updateweatherstation.php" in that folder, so this is a valid path:

192.168.1.100/weatherstation/updateweatherstation.php

updateweatherstation.php shall contain this:

Code: [Select]
<?php

$queryString 
$_SERVER['QUERY_STRING'];

parse_str($queryString$output);

$jsonformat json_encode($output);

$jsonFile fopen("data.json""w") or die("Unable to open file!");

fwrite($jsonFile$jsonformat);

fclose($jsonFile);

http_response_code(200);

?>
Please note, above is just for testing, script should be protected against attacks but you should be fine since its on your own server not exposed to the world, yes?

In WS View, select "Wunderground" as protocol and type in 192.168.1.100 as hostname, port 80. Click save and finish.

Above should generate a JSON-file in 192.168.1.100/weatherstation with latest data.

Regards

would you, by any chance, be willing to share a similar example of code for the Ecowitt protocol?

Not sure which way to go in the future but I would like to compare the two sets of data.


Offline droiddk

  • Forecaster
  • *****
  • Posts: 334
Re: Advice needed please - GW1001
« Reply #29 on: September 23, 2019, 03:47:32 PM »

would you, by any chance, be willing to share a similar example of code for the Ecowitt protocol?

Not sure which way to go in the future but I would like to compare the two sets of data.

Hello

Try this:

Code: [Select]
<?php

$jsonformat json_encode($_POST);

$jsonFile fopen("data.json""w") or die("Unable to open file!");

fwrite($jsonFile$jsonformat);

fclose($jsonFile);

http_response_code(200);

?>

Insert into index.php and place index.php in http://yourwebsite.com/data/report

Above is very simplified and there should always be some sort of input-validating/testing for preventing hijacks. Use code at own risk and to get password from console and then update code with password testing.

Server ip/hostname in ws view is yourwebsite.com

Regards
« Last Edit: May 04, 2020, 11:02:38 AM by droiddk »

Offline Thor72

  • Member
  • *
  • Posts: 4
Re: Advice needed please - GW1001
« Reply #30 on: September 23, 2019, 06:06:57 PM »
Thanks a lot, this is very much appreciated
(feeling like a little kid at Christmas, seeing the data getting written into a file)

presently this goes to a server on my network which is not open to the www.

I will have look at what you are saying about

Above is very simplified and there should always be some sort of input-validating/testing for preventing hijacks. Use code at own risk.

I am now comparing the data sets of the two protocols