From c2c1e1db00112f6cddc964d496a75a5ca7e88aca Mon Sep 17 00:00:00 2001 From: Lorenz Date: Fri, 9 May 2025 21:48:06 +0200 Subject: [PATCH] some more keys --- README.md | 1 + both.php | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5cd0d85..c7a4b19 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ The `both.php` file supports both **Ecowitt** and **Wunderground** protocols. - **HTTP Method**: GET - **Data Format**: URL parameters (Query Parameters) +- **Protocol**: https://support.weather.com/s/article/PWS-Upload-Protocol?language=en_US #### Example GET Data: diff --git a/both.php b/both.php index 7a7f691..9df8663 100644 --- a/both.php +++ b/both.php @@ -18,7 +18,12 @@ $WUNDERGROUND_TO_ECOWITT = array( 'dateutc' => 'dateutc', 'solarradiation' => 'solarradiation', 'softwaretype' => 'stationtype', + // not sure about the following keys + 'lowbatt'=> 'wh65batt', + 'rainin' => 'rainratein', ); + +// TDOD: make mapping for these keys //POST (ecowitt): // [PASSKEY] => 123***************************** // [runtime] => 296 @@ -27,11 +32,9 @@ $WUNDERGROUND_TO_ECOWITT = array( // [baromabsin] => 28.804 // [vpd] => 0.290 // [maxdailygust] => 11.41 -// [rainratein] => 0.000 // [eventrainin] => 0.000 // [hourlyrainin] => 0.000 // [totalrainin] => 0.000 -// [wh65batt] => 0 // [freq] => 868M // [model] => GW2000A // [interval] => 8 @@ -41,19 +44,19 @@ $WUNDERGROUND_TO_ECOWITT = array( // [PASSWORD] => 1 // [dewptf] => 55.04 // [windchillf] => 69.44 -// [rainin] => 0.000 // [baromin] => 28.804 -// [lowbatt] => 0 // [action] => updateraw // [realtime] => 1 // [rtfreq] => 5 $NORMALIZATION = array( + // TODO: round float to only two decimal places 'dateutc' => fn ($dt) => new DateTimeImmutable($dt), 'tempf' => fn ($temp) => normalizeTemperature($temp), 'indoortempf' => fn ($temp) => normalizeTemperature($temp), 'windspeedmph' => fn ($mph) => normalizeSpeed($mph), 'windgustmph' => fn ($mph) => normalizeSpeed($mph), + // TODO: add missing keys from mapping ); function ecowittKey($key)