Hi,
I am using the following php script to grab data from my WeatherFlow Tempest station and then successfully upload them to Windy.com.
A cron job is used to run it every 5 minutes.
No additional weather software is needed.
Enjoy,
Kostas
/*
* This php script grabs data from a WeatherFlow Tempest station and
* uploads them to Windy.com.
* Use a cron job to run it every 5 minutes.
* No additional weather software is needed.
*/
// Download data from WeatherFlow Tempest station (use your own Token)
$url = 'https://swd.weatherflow.com/swd/rest/observations/station/your-own-station-id?token=XXXXXXXXXXXX';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
curl_close($curl);
// Decode data so they can be used
$data = json_decode($data);
// Calculate variables
$ts = urlencode($data->obs[0]->timestamp);
$temp = urlencode($data->obs[0]->air_temperature);
$wind = urlencode($data->obs[0]->wind_avg);
$winddir = urlencode($data->obs[0]->wind_direction);
$gust = urlencode($data->obs[0]->wind_gust);
$rh = urlencode($data->obs[0]->relative_humidity);
$dewpoint = urlencode($data->obs[0]->dew_point);
$mbar = urlencode($data->obs[0]->barometric_pressure);
$precip = urlencode($data->obs[0]->precip);
$uv = urlencode($data->obs[0]->uv);
// Upload data to Windy.com (use your own Windy API-KEY)
$url3 = "https://stations.windy.com/pws/update/API-KEY?winddir=$winddir&wind=$wind&gust=$gust&temp=$temp&precip=$precip&mbar=$mbar&dewpoint=$dewpoint&rh=$rh&uv=$uv";
//var_dump($url3); //test only
$curl3 = curl_init();
curl_setopt($curl3, CURLOPT_URL, $url3);
curl_setopt($curl3, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl3, CURLOPT_HEADER, false);
$data3 = curl_exec($curl3);
curl_close($curl3);
//var_dump($data3); //test only