I think I see the problem. You have both Server alerts and AS3935 alerts enabled. However, both alert types will call the same PHP script. The PHP script will only parse the parameters sent when the PHP call is triggered by the AS3935.
The erroneous data is caused by the PHP script being triggered by server alerts. Tobi used some common variable names between those included in the AS3935 alerts and the Server alerts. Those comon variables are being parsed by the PHP script, but the others are missing! That's why only the common parameter names are being registered.
There is also a precedence issue with having two AS3935 alerts defined with different criteria.
The logging script assumes the AS3935 action triggers on a single strike.
So, disable the Server alerts. Disable all but one AS3935 action and set it to trigger on a single strike at the desired distance, calling whatever action you wish. It is best that the action called is the first in the Actions list, as that one will have priority over the others. If you only have one Action defined, this should not matter.
I hope this all makes sense....Confusing.
I do have a new script that can detect if the Action is triggered by the AS3935 or a Server alert. It routes the data to a different log file, if triggered by a Server alert. However, you need to have both the AS3935 and Server alert call the SAME action to avoid one alert blocking the other.
Whew!
Here's the new script:
<?php
date_default_timezone_set('America/Chicago');
$date = date("m/d/Y");
$time = date("G:i:s");
$datetime = "$date $time";
# Retrieve all possible value names and values from Controller on strike event for testing and save to file.
# $file_test = fopen("/volume1/web/as3935_test.txt","w");
# foreach ($_GET as $key => $value)
# {
# fwrite($file_test,"$key: $value\n");
# }
# fclose($file_test);
# Combined parameters (AS3935 and Server Alerts)
$strokes = $_GET['strokes'];
$dist_min = $_GET['dist_min'];
$dist_max = $_GET['dist_max'];
# AS3935 Parameters
$disturbers = $_GET['disturbers'];
$duration = $_GET['duration'];
if ($duration <= 60) {
($rate = 0);
} else {
$rate = round(($strokes/$duration*60),2);
}
$dist = $_GET['dist'];
$energy = $_GET['energy'];
$energy_min = $_GET['energy_min'];
$energy_max = $_GET['energy_max'];
$strokes_all = $_GET['strokes_all'];
$disturbers_all = $_GET['disturbers_all'];
$events = $_GET['events'];
# Server Alert Parameters
$action = $_GET['action'];
$name = $_GET['name'];
$first = $_GET['first'];
$last = $_GET['last'];
$name = $_GET['name'];
$strokes_per_min_last = $_GET['strokes_per_min_last'];
$strokes_per_min_max = $_GET['strokes_per_min_max'];
$arrival_time = $_GET['arrival_time'];
$dist_last = $_GET['dist_last'];
$degerees_last = $_GET['degerees_last'];
$degrees_mean = $_GET['degrees_mean'];
$trend_pct = $_GET['trend_pct'];
$trend_sec = $_GET['trend_sec'];
if ($energy) {
if (!file_exists("/volume1/web/as3935_log.txt")) {
$file = fopen("/volume1/web/as3935_log.txt","w");
fwrite($file,"Date,Time,Date-Time,Event Strokes,Event Disturbers,Event Duration,Event Strike Rate,Current Strike Distance,Event Min Distance,Event Max Distance,Current Strike Energy,Event Min Energy,Event Max Energy,All Strokes,All Disturbers,Events\n");
fclose($file);
}
$file = fopen("/volume1/web/as3935_log.txt","a");
fwrite($file,"$date,$time,$datetime,$strokes,$disturbers,$duration,$rate,$dist,$dist_min,$dist_max,$energy,$energy_min,$energy_max,$strokes_all,$disturbers_all,$events\n");
fclose($file);
$file2 = fopen("/volume1/web/as3935_display.txt","w");
fwrite($file2,"\nLast Strike\n==== ======\nLatest Strike:.................$date $time\nLatest Strike Distance:........$dist KM\nLatest Strike Energy:..........$energy\n\nLast Event\n==== =====\nNumber of Strikes in Event:....$strokes\nLightning Event Duration:......$duration Seconds\nCurrent Event Strike Rate:.....$rate Strikes/Minute\nShortest Distance to Strike:...$dist_min KM\nLongest Distance to Strike:....$dist_max KM\nLowest Strike Intensity:.......$energy_min\nHighest Strike Intensity:......$energy_max\nTotal strikes since reboot:....$strokes_all\n");
fclose($file2);
}
if ($dist_last) {
if (!file_exists("/volume1/web/alerts_log.txt")) {
$file = fopen("/volume1/web/alerts_log.txt","w");
fwrite($file,"Date,Time,Date-Time,Action Number,Action Name,First Strike Time,Last Strike Time,Number of Strikes,Last Strike Rate,Max Strike Rate,Arrival Time,Last Strike Distance,Min Strike Distance,Max Strike Distance,Last Strike Bearing,Mean Strike Bearing,Trend Percent,Trend Seconds\n");
fclose($file);
}
$file = fopen("/volume1/web/alerts_log.txt","a");
fwrite($file,"$date,$time,$datetime,$action,$name,$first,$last,$strokes,$strokes_per_min_last,$strokes_per_min_max,$arrival_time,$dist_last,$dist_min,$dist_max,$degerees_last,$degrees_mean,$trend_pct,$trend_sec\n");
fclose($file);
$file2 = fopen("/volume1/web/alerts_display.txt","w");
fwrite($file2,"\nLast Strike\n==== ======\nLatest Strike:.................$last\nLatest Strike Distance:........$dist_last KM\nLatest Strike Rate:............$strokes_per_min_last Strikes/Minute\nLatest Strike Bearing:.........$degerees_last Degrees\n\nLast Event\n==== =====\nFirst Lightning in Event:......$first\nMaximum Event Strike Rate:.....$strokes_per_min_max Strikes/Minute\nShortest Distance to Strike:...$dist_min KM\nLongest Distance to Strike:....$dist_max KM\nMean Strike Bearing:...........$degrees_mean Degrees\n");
fclose($file2);
}
?>
Note I added a line to set the time zone in the first line of the script.
Don
WD9DMP