Author Topic: AirLink export - new WiFiLogger feature  (Read 802 times)

0 Members and 1 Guest are viewing this topic.

Offline WiFiLogger

  • Forecaster
  • *****
  • Posts: 706
AirLink export - new WiFiLogger feature
« on: April 01, 2022, 09:15:52 AM »
I have made new function in WiFiLogger.
I have add new menu where user can enable/disable up to 5 AirLink, or WeatherLink Live (because WLL use the same interface).
When user set local IP of own AirLink inside home network and user will add link to external server with PHP file (test PHP is provided by me), then every 5 minutes (fixed) WiFilogger will connect to the defined AirLinks/WLLs grab raw JSON data and send it to the PHP script.

With this simple procedure you can save AirLink/WLL data on your own server.

 [ You are not allowed to view attachments ]

 [ You are not allowed to view attachments ]

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 5244
    • KomokaWeather
Re: AirLink export - new WiFiLogger feature
« Reply #1 on: April 01, 2022, 12:31:15 PM »
Hi Wojtek,
I have updated firmware and have the AirLink set up, and a [test] displays the Airlink data in the lower box.  I've used the IP for both Airlink and WLL and both show their data in that box.  So I think that is all ok.

I entered the full path to execute airlink.php and a .json file was created in the remote folder but it was blank, and an error-log
Quote
[01-Apr-2022 16:05:27 UTC] PHP Notice:  Undefined variable: json_source in /home/psoykkrhjuz3/public_html/wifi-console/airlink/airlink.php on line 16
[01-Apr-2022 16:05:27 UTC] PHP Notice:  Trying to access array offset on value of type null in /home/psoykkrhjuz3/public_html/wifi-console/airlink/airlink.php on line 17
[01-Apr-2022 16:05:27 UTC] PHP Notice:  Trying to access array offset on value of type null in /home/psoykkrhjuz3/public_html/wifi-console/airlink/airlink.php on line 20
[01-Apr-2022 16:05:27 UTC] PHP Notice:  Undefined variable: json_source in /home/psoykkrhjuz3/public_html/wifi-console/airlink/airlink.php on line 23
[01-Apr-2022 16:05:27 UTC] PHP Notice:  Trying to access array offset on value of type null in /home/psoykkrhjuz3/public_html/wifi-console/airlink/airlink.php on line 27



I then edited the .php on line 20 to rename .json to airlink.json and then run the php script again and an airlink.json file was created on the remote but it is still empty, and a new error_log as above.


What have I missed?  and is WFL to execute that airlink.php every 5 minutes?  That hasn't happened.

Enjoy,
Paul

Davis Vantage Pro 2 Plus 24-FARS Wireless - Komoka, ON Canada
Envoy/USB Logger/Cumulus v1.9.4  www.komokaweather.com  
WFL/CMX www.komokaweather.com/komokaweather-ca2/index.php
WLL/CMX www.komokaweather.com/cumulusmxwll/index.htm
WLL/CMX www.komokaweather.com/cumulusmxwll/index.html
WLL/CMX www.komokaweather.com/cumulusmxwll/index.php
Blitzortung Station #1076


Offline WiFiLogger

  • Forecaster
  • *****
  • Posts: 706
Re: AirLink export - new WiFiLogger feature
« Reply #2 on: April 01, 2022, 12:44:40 PM »
What have I missed?  and is WFL to execute that airlink.php every 5 minutes?  That hasn't happened.
[/size]

Please try on my test server. http://wifilogger.net/airlink/airlink.php

Maybe my test script in PHP is not executing the same way on your server.

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 5244
    • KomokaWeather
Re: AirLink export - new WiFiLogger feature
« Reply #3 on: April 01, 2022, 01:01:39 PM »
Hi Wojtek,
I have entered your server url in my airlink settings and did a [test].  What should I be seeing?
Is WiFiLogger to run the airlink.php script every 5 minutes?  Nothing seems to happen unless I manually execute it in komokaweather.com/wifi-console/airlink/ and then the blank file and error-log.


Enjoy,
Paul
Davis Vantage Pro 2 Plus 24-FARS Wireless - Komoka, ON Canada
Envoy/USB Logger/Cumulus v1.9.4  www.komokaweather.com  
WFL/CMX www.komokaweather.com/komokaweather-ca2/index.php
WLL/CMX www.komokaweather.com/cumulusmxwll/index.htm
WLL/CMX www.komokaweather.com/cumulusmxwll/index.html
WLL/CMX www.komokaweather.com/cumulusmxwll/index.php
Blitzortung Station #1076


Offline WiFiLogger

  • Forecaster
  • *****
  • Posts: 706
Re: AirLink export - new WiFiLogger feature
« Reply #4 on: April 01, 2022, 06:15:27 PM »
Hi Wojtek,
I have entered your server url in my airlink settings and did a [test].  What should I be seeing?

https://wifilogger.net/airlink/001D0A10050E.json

When airlink.php will grab data from WiFilogger, then it is putting it into JSON file in the same directory.
It can save multiple files, so name of the file is DID, because it is unique.

My script is working fine on my hosting. Probably your hosting has different PHP version.

Code: [Select]
while ($rawputdata = fread($putdata, 1024)){
$json_source = $json_source.$rawputdata;
}
Issue is within this function. It is reading chunk of 1024 bytes from input buffer and put it into variable. It is repeating it multiple times up to the end of the buffer.
It looks like while loop is not executed. But it can be issue with opening stream file before that.
Code: [Select]
$putdata = fopen("php://input", "r");
More investigating is needed. I am not very familiar with PHP  :-(

Offline jcookjr82

  • Contributor
  • ***
  • Posts: 112
Re: AirLink export - new WiFiLogger feature
« Reply #5 on: April 05, 2022, 01:27:51 PM »
Have you though about adding the AirLink info to the Realtime Data screen?
Davis Vantage Vue
LaCrosse 2813 (retired 1/17/2018)

Offline WiFiLogger

  • Forecaster
  • *****
  • Posts: 706
Re: AirLink export - new WiFiLogger feature
« Reply #6 on: April 05, 2022, 01:35:27 PM »
Have you though about adding the AirLink info to the Realtime Data screen?

Yes, I could think about it.
Could it be like rain down below?

 [ You are not allowed to view attachments ]

Offline jcookjr82

  • Contributor
  • ***
  • Posts: 112
Re: AirLink export - new WiFiLogger feature
« Reply #7 on: April 06, 2022, 01:04:23 PM »
I think it would make a nice touch to have all the data on the same page. You're the programmer so I have no idea of the process, but you have generally been able to implement most suggested features by end users. Thanks for the consideration.
Davis Vantage Vue
LaCrosse 2813 (retired 1/17/2018)

Offline WiFiLogger

  • Forecaster
  • *****
  • Posts: 706
Re: AirLink export - new WiFiLogger feature
« Reply #8 on: April 06, 2022, 01:09:03 PM »
I think it would make a nice touch to have all the data on the same page. You're the programmer so I have no idea of the process, but you have generally been able to implement most suggested features by end users. Thanks for the consideration.

Ok I will try.

Offline kasparsz

  • Member
  • *
  • Posts: 1
Re: AirLink export - new WiFiLogger feature
« Reply #9 on: July 01, 2022, 01:47:28 AM »
I think it would make a nice touch to have all the data on the same page. You're the programmer so I have no idea of the process, but you have generally been able to implement most suggested features by end users. Thanks for the consideration.

Ok I will try.

Hi ;) how is going with this feature? :)