También lo estoy usando para enviar datos a la red AWEKAS (mismo protocolo que Wunderground) y para Windy
/**
* Convierte los datos posteados en protocolo ECOWITT a protocolo WUNDERGROUND (AWEKAS)
* @param mixed $data Datos posteados
* @param mixed $WU_ID
* @param mixed $WU_KEY
* @return array|array{ID: mixed, PASSWORD: mixed, UV: mixed, action: string, baromin: mixed, dailyrainin: mixed, dateutc: string, dewptf: mixed, humidity: mixed, rainin: mixed, softwaretype: string, solarRadiation: mixed, tempf: mixed, totalrainin: mixed, winddir: mixed, windspeedmph: mixed}
*/
function ew2wu($data, $WU_ID, $WU_KEY)
{
try {
$wu_data = [
'ID' => $WU_ID,
'PASSWORD' => $WU_KEY,
'dateutc' => 'now',
'tempf' => isset($data['tempf']) ? $data['tempf'] : null,
'humidity' => isset($data['humidity']) ? $data['humidity'] : null,
'dewptf' => isset($data['dewptf']) ? $data['dewptf'] : null,
'baromin' => isset($data['baromrelin']) ? ($data['baromrelin']) : null,
'windgustmph' => isset($data['windgustmph']) ? $data['windgustmph'] : null,
'windspeedmph' => isset($data['windspeedmph']) ? $data['windspeedmph'] : null,
'winddir' => isset($data['winddir']) ? $data['winddir'] : null,
'rainin' => isset($data['rainratein']) ? $data['rainratein'] : null,
'dailyrainin' => isset($data['dailyrainin']) ? $data['dailyrainin'] : null,
'totalrainin' => isset($data['totalrainin']) ? $data['totalrainin'] : null,
'solarradiation' => isset($data['solarradiation']) ? $data['solarradiation'] : null,
'UV' => isset($data['uv']) ? $data['uv'] : null,
'softwaretype' => 'Ecowitt-Converter-PHP',
'action' => 'updateraw'
];
return $wu_data;
} catch (Exception $e) {
return [];
}
}
Para usarlo...
$awquery=http_build_query(ew2wu($datos,$AW_ID,$AW_PW));
$awekasUrl = "http://ws.awekas.at/weatherstation/updateweatherstation.php?".$awquery;
file_get_contents($awekasUrl);
Y para Windy,
$windy_url = "https://stations.windy.com/pws/update/$WD_KEY?stationId=0&".$awquery;
if (date('i') % 5 == 0)
file_get_contents($windy_url);