Send data to windy.com #18
Labels
[Feature] Extensibility and APIs
All things related to new APIS, devices ...
[Priority] Low
[Type] Enhancement
New feature or request
Milestone
Hi Jason
Congratulation with taking over the source code for weather station it was long needed, that someone carried it on onwards. We have been using the weather station module for number of years now and have developed quite a page combining data from weather station with other data sources see more details on: https://www.gillelejesejlklub.dk/vejret/
I'm also sharing data from weather station to https://stations.windy.com/ using some code I have built.
You are free to use the source code below if you want to include the capability in weather station.
function ws_get_windy_token( $token = "")
{
$token = " Register your station on https://stations.windy.com/ to get key "; // <- Replace this with your own token
return $token;
}
//-----------------------> Post to windy.com <---------------------------------
function ws_dopost($url, $json)
{
$fields = (is_array($json)) ? http_build_query($json) : $json;
if($ch = curl_init($url))
{
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
$json = curl_exec($ch);
}
else
{
return false;
}
}
//-----------------------> Get the weatherlink data for you upload <---------------------------------
function ws_get_weatherlinkdata($message = "" )
{
}
//-----------------------> main code code for sending data to windy <---------------------------------
function ws_put_weatherdata_to_windy( )
{
}
//-----------------------> adding the cron task for schedule job <---------------------------------
//-----------------------> remember to set the scedule to max 5 minutes <---------------------------------
add_action( 'init', function () {
} );
add_action( 'run_windy_update', function () {
} );
The text was updated successfully, but these errors were encountered: