8 Commits

Author SHA1 Message Date
Jeremias Wolff
231014566a Merge pull request #8 from notnullxyz/main
Fix wind index. Add debug logging. Get it working with the http dep
2023-11-01 07:54:46 +01:00
notnullxyz
9ffdea3702 PHP Linting (Pint) 2023-11-01 06:51:40 +00:00
Marlon van der Linde
4cb82af4c1 Merge pull request #1 from comes/main
Merge catchup. Confusing day.
2023-11-01 08:51:14 +02:00
Jeremias Wolff
7145396ca5 Merge pull request #10 from comes/comes-patch-2
Update pint.yml
2023-10-30 19:24:23 +01:00
comes
a4e7450cfd PHP Linting (Pint) 2023-10-30 18:23:28 +00:00
Jeremias Wolff
6f66e00145 Update pint.yml 2023-10-30 19:23:07 +01:00
Jeremias Wolff
8a15050614 Merge pull request #9 from comes/comes-patch-1
Create pint.yml
2023-10-30 19:18:16 +01:00
Marlon van der Linde
829a802ce1 Fix wind index. Add debug logging. Get it working with the http dep 2023-10-30 16:48:29 +02:00
4 changed files with 1371 additions and 42 deletions

View File

@@ -12,7 +12,7 @@ jobs:
with: with:
fetch-depth: 2 fetch-depth: 2
- name: "laravel-pint" - name: "laravel-pint"
uses: aglipanci/laravel-pint-action@0.1.0 uses: aglipanci/laravel-pint-action@2.3.0
with: with:
preset: laravel preset: laravel

View File

@@ -95,35 +95,35 @@ class EcowittExportCommand extends Command
$this->times = data_get($ecowitt, 'times', []); $this->times = data_get($ecowitt, 'times', []);
// Temperature in C // Temperature in C
$this->debug('fetch outdoor temp'); $this->debug('fetch outTemp');
$outdoorTemp = $this->getData($ecowitt, 'list.tempf.list.tempf'); $outdoorTemp = $this->getData($ecowitt, 'list.tempf.list.tempf');
// Feels Like in C // Feels Like in C
$this->debug('fetch outdoor temp gust'); $this->debug('fetch outTempApp');
$outdoorTempGust = $this->getData($ecowitt, 'list.tempf.list.apparent_temp'); $outdoorTempApp = $this->getData($ecowitt, 'list.tempf.list.apparent_temp');
// Dew Point in C // Dew Point in C
$this->debug('collecting: Dew Point in C'); $this->debug('fetch dewpoint');
$outdoorDewTemp = $this->getData($ecowitt, 'list.tempf.list.drew_temp'); $outdoorTempDew = $this->getData($ecowitt, 'list.tempf.list.drew_temp'); // yes ecowitt calls it drew_temp :)
// humidity in % // humidity in %
$this->debug('collecting: humidity in %'); $this->debug('fetch outHumidity %');
$outdoorHumidity = $this->getData($ecowitt, 'list.humidity.list.humidity'); $outdoorHumidity = $this->getData($ecowitt, 'list.humidity.list.humidity');
// temp indoor in C // temp indoor in C
$this->debug('collecting: temp indoor in C'); $this->debug('fetch inTemp');
$indoorTemp = $this->getData($ecowitt, 'list.tempinf.list.tempinf'); $indoorTemp = $this->getData($ecowitt, 'list.tempinf.list.tempinf');
// humidityin in % // humidityin in %
$this->debug('collecting: humidityin in %'); $this->debug('fetch inHumidityin %');
$indoorHumidity = $this->getData($ecowitt, 'list.humidity.list.humidity'); $indoorHumidity = $this->getData($ecowitt, 'list.humidityin.list.humidityin');
// solar in lx -- Solar and UVI // solar in lx -- Solar and UVI
$this->debug('collecting: solar in lx -- Solar and UVI'); $this->debug('fetch solar radiation');
$solarradiation = $this->getData($ecowitt, 'list.so_uv.list.solarradiation'); $solarRadiation = $this->getData($ecowitt, 'list.so_uv.list.solarradiation');
// uv // uv
$this->debug('collecting: uv'); $this->debug('fetch uv index');
$uvi = $this->getData($ecowitt, 'list.so_uv.list.uv'); $uvi = $this->getData($ecowitt, 'list.so_uv.list.uv');
//replace empty values with 0 //replace empty values with 0
@@ -134,62 +134,76 @@ class EcowittExportCommand extends Command
} }
// rainrate in mm/hr b // rainrate in mm/hr b
$this->debug('collecting: rainrate in mm/hr b'); $this->debug('fetch rainratein');
$rainRateH = $this->getData($ecowitt, 'list.rain.list.rainratein'); $rainRateIn = $this->getData($ecowitt, 'list.rain.list.rainratein');
// daily rainrate total mm/hr // daily rainrate total mm/hr
$this->debug('collecting: daily rainrate total mm/hr'); $this->debug('fetch dailyrainin');
$rainRateDaily = $this->getData($ecowitt, 'list.rain.list.dailyrainin'); $dailyRainIn = $this->getData($ecowitt, 'list.rain.list.dailyrainin');
// wind_speed in m/s // wind_speed in m/s
$this->debug('collecting: wind_speed in m/s'); $this->debug('fetch windspeedmph (kmh)');
$windspeed = $this->getData($ecowitt, 'list.wind_speed.list.windspeedmph'); $windSpeed = $this->getData($ecowitt, 'list.wind.list.windspeedmph'); // this key is called mph but units in data struct is kmh :/
// windGust // windGust
$this->debug('collecting: windGust'); $this->debug('fetch windgustmph (kmh)');
$windGust = $this->getData($ecowitt, 'list.wind_speed.list.windgustmph'); $windGust = $this->getData($ecowitt, 'list.wind.list.windgustmph'); // wind gust key called mph but units in data struct is kmh
// winddir in degree // winddir in degree
$this->debug('collecting: winddir in degree'); $this->debug('fetch winddir');
$windir = $this->getData($ecowitt, 'list.winddir.list.winddir'); $windDir = $this->getData($ecowitt, 'list.wind.list.winddir');
// pressure relative in hPa // pressure relative in hPa
$this->debug('collecting: pressure relative in hPa'); $this->debug('fetch baromrelin');
$pressureRel = $this->getData($ecowitt, 'list.pressure.list.baromrelin'); $pressureRel = $this->getData($ecowitt, 'list.pressure.list.baromrelin');
// pressure absolute in hPa // pressure absolute in hPa
$this->debug('collecting: pressure absolute in hPa'); $this->debug('fetch baromabsin');
$pressureAbs = $this->getData($ecowitt, 'list.pressure.list.baromabsin'); $pressureAbs = $this->getData($ecowitt, 'list.pressure.list.baromabsin');
foreach ($outdoorTemp as $date => $temp) { foreach ($outdoorTemp as $date => $temp) {
if (! $temp) {
$this->debug('Skipping a bogus index');
continue;
}
$this->debug('unpacking $temp: '.$temp);
$tmp = [ $tmp = [
'date_and_time' => $date, // %Y-%m-%d %H:%M:%S 'time' => $date, // %Y-%m-%d %H:%M:%S
'temp_out' => $temp, // degree
'temp_out_gust' => data_get($outdoorTempGust, $date), // degree 'outTemp' => $temp, // degree
'temp_out_dew' => data_get($outdoorDewTemp, $date), // degree 'outTempApp' => data_get($outdoorTempApp, $date), // degree
'humid_out' => data_get($outdoorHumidity, $date), // percent 'dewpoint' => data_get($outdoorTempDew, $date), // degree
'temp_in' => data_get($indoorTemp, $date), // degree 'outHumidity' => data_get($outdoorHumidity, $date), // percent
'humid_in' => data_get($indoorHumidity, $date), // percent
'rad' => data_get($solarradiation, $date), // lx 'inTemp' => data_get($indoorTemp, $date), // degree
'inHumidity' => data_get($indoorHumidity, $date), // percent
'radiation' => data_get($solarRadiation, $date), // lx
'uv' => data_get($uvi, $date), 'uv' => data_get($uvi, $date),
'rain' => data_get($rainRateH, // mm
'rain_rate' => data_get($rainRateIn, // mm
$date $date
), ),
'rain_daily' => data_get($rainRateDaily, $date), // mm 'rain_daily' => data_get($dailyRainIn, $date), // mm
'wind' => data_get($windspeed, // m_per_second
'wind_speed' => data_get($windSpeed, // m_per_second
$date $date
), ),
'wind_gust' => data_get($windGust, $date), // m_per_second 'windGust' => data_get($windGust, $date), // m_per_second
'wind_dir' => data_get($windir, $date), // degree_compass 'windDir' => data_get($windDir, $date), // degree_compass
'pressure_rel' => data_get($pressureRel, $date), // hPa
'pressure_abs' => data_get($pressureAbs, $date), // hPa 'pressure_abs' => data_get($pressureAbs, $date), // hPa
'pressure_rel' => data_get($pressureRel, $date),
]; ];
$outputData[] = $tmp; $outputData[] = $tmp;
} }
$startDate = $startDate->addDay()->startOfDay(); $startDate = $startDate->addDay()->startOfDay();
} while ($startDate->lte($endDate)); } while ($startDate->lte($endDate));
$this->export(getcwd()."/ecowitt_{$deviceId}.csv", $outputData); $outFile = getcwd()."/export_ecowitt_{$deviceId}.csv";
$this->export($outFile, $outputData);
$this->debug('exported to output file: '.$outFile);
}); });
} }

View File

@@ -17,6 +17,8 @@
], ],
"require": { "require": {
"php": "^8.1", "php": "^8.1",
"guzzlehttp/guzzle": "^7.5",
"illuminate/http": "^10.0",
"laravel-zero/framework": "^10.0.2", "laravel-zero/framework": "^10.0.2",
"nunomaduro/termwind": "^1.15.1" "nunomaduro/termwind": "^1.15.1"
}, },

1317
composer.lock generated

File diff suppressed because it is too large Load Diff