Skip to content

Commit

Permalink
Merge pull request #163 from mcrossley/master
Browse files Browse the repository at this point in the history
v3.22.3
  • Loading branch information
mcrossley authored Nov 3, 2022
2 parents cc8173d + 9afc3c2 commit 096c15f
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 89 deletions.
6 changes: 3 additions & 3 deletions CumulusMX/Alarm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void doTriggered(bool value)
// If we were not set before, so we need to send an email?
if (!triggered && Enabled)
{
cumulus.LogMessage($"Alarm ({Name}): Triggered");
cumulus.LogMessage($"Alarm ({Name}): Triggered, value = {Value}");

if (Email && cumulus.SmtpOptions.Enabled && cumulus.emailer != null)
{
Expand Down Expand Up @@ -202,7 +202,7 @@ private void doUpTriggered(bool value)
// If we were not set before, so we need to send an email etc?
if (!upTriggered && Enabled)
{
cumulus.LogMessage($"Alarm ({Name}): Up triggered");
cumulus.LogMessage($"Alarm ({Name}): Up triggered, value = {Value}");

if (Email && cumulus.SmtpOptions.Enabled && cumulus.emailer != null)
{
Expand Down Expand Up @@ -268,7 +268,7 @@ private void doDownTriggered(bool value)
// If we were not set before, so we need to send an email?
if (!downTriggered && Enabled)
{
cumulus.LogMessage($"Alarm ({Name}): Down triggered");
cumulus.LogMessage($"Alarm ({Name}): Down triggered, value = {Value}");

if (Email && cumulus.SmtpOptions.Enabled && cumulus.emailer != null)
{
Expand Down
16 changes: 8 additions & 8 deletions CumulusMX/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,25 +383,25 @@ public async Task GetGraphData(string req)
switch (req)
{
case "tempdata.json":
await writer.WriteAsync(Station.GetTempGraphData());
await writer.WriteAsync(Station.GetTempGraphData(DateTime.Now));
break;
case "winddata.json":
await writer.WriteAsync(Station.GetWindGraphData());
await writer.WriteAsync(Station.GetWindGraphData(DateTime.Now));
break;
case "raindata.json":
await writer.WriteAsync(Station.GetRainGraphData());
await writer.WriteAsync(Station.GetRainGraphData(DateTime.Now));
break;
case "pressdata.json":
await writer.WriteAsync(Station.GetPressGraphData());
await writer.WriteAsync(Station.GetPressGraphData(DateTime.Now));
break;
case "wdirdata.json":
await writer.WriteAsync(Station.GetWindDirGraphData());
await writer.WriteAsync(Station.GetWindDirGraphData(DateTime.Now));
break;
case "humdata.json":
await writer.WriteAsync(Station.GetHumGraphData());
await writer.WriteAsync(Station.GetHumGraphData(DateTime.Now));
break;
case "solardata.json":
await writer.WriteAsync(Station.GetSolarGraphData());
await writer.WriteAsync(Station.GetSolarGraphData(DateTime.Now));
break;
case "dailyrain.json":
await writer.WriteAsync(Station.GetDailyRainGraphData());
Expand All @@ -419,7 +419,7 @@ public async Task GetGraphData(string req)
await writer.WriteAsync(Station.GetGraphConfig());
break;
case "airqualitydata.json":
await writer.WriteAsync(Station.GetAqGraphData());
await writer.WriteAsync(Station.GetAqGraphData(DateTime.Now));
break;
case "availabledata.json":
await writer.WriteAsync(Station.GetAvailGraphData());
Expand Down
10 changes: 6 additions & 4 deletions CumulusMX/Cumulus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2185,6 +2185,8 @@ private void WebTimerTick(object sender, ElapsedEventArgs e)
return;
}

var now = DateTime.Now;

if (WebUpdating == 1)
{
LogMessage("Warning, previous web update is still in progress, first chance, skipping this interval");
Expand All @@ -2197,13 +2199,13 @@ private void WebTimerTick(object sender, ElapsedEventArgs e)
ftpThread.Abort();
LogMessage("Trying new web update");
WebUpdating = 1;
ftpThread = new Thread(DoHTMLFiles) { IsBackground = true };
ftpThread = new Thread(() => DoHTMLFiles(now)) { IsBackground = true };
ftpThread.Start();
}
else
{
WebUpdating = 1;
ftpThread = new Thread(DoHTMLFiles) { IsBackground = true };
ftpThread = new Thread(() => DoHTMLFiles(now)) { IsBackground = true };
ftpThread.Start();
}
}
Expand Down Expand Up @@ -8317,7 +8319,7 @@ public void ExecuteProgram(string externalProgram, string externalParams)
Process.Start(start);
}

public void DoHTMLFiles()
public void DoHTMLFiles(DateTime ts)
{
try
{
Expand All @@ -8339,7 +8341,7 @@ public void DoHTMLFiles()
LogDebugMessage("Done creating standard Data file");

LogDebugMessage("Creating graph data files");
station.CreateGraphDataFiles();
station.CreateGraphDataFiles(ts);
LogDebugMessage("Done creating graph data files");

//LogDebugMessage("Creating extra files");
Expand Down
4 changes: 2 additions & 2 deletions CumulusMX/CumulusMX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
<Reference Include="MimeKit, Version=3.4.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL">
<HintPath>..\packages\MimeKit.3.4.1\lib\net48\MimeKit.dll</HintPath>
</Reference>
<Reference Include="MQTTnet, Version=4.1.0.247, Culture=neutral, PublicKeyToken=fdb7629f2e364a63, processorArchitecture=MSIL">
<HintPath>..\packages\MQTTnet.4.1.0.247\lib\net461\MQTTnet.dll</HintPath>
<Reference Include="MQTTnet, Version=4.1.1.318, Culture=neutral, PublicKeyToken=fdb7629f2e364a63, processorArchitecture=MSIL">
<HintPath>..\packages\MQTTnet.4.1.1.318\lib\net461\MQTTnet.dll</HintPath>
</Reference>
<Reference Include="MySqlConnector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92, processorArchitecture=MSIL">
<HintPath>..\packages\MySqlConnector.2.1.13\lib\net471\MySqlConnector.dll</HintPath>
Expand Down
23 changes: 10 additions & 13 deletions CumulusMX/DataEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -812,13 +812,13 @@ internal string GetRecordsLogFile(string recordType)
}

// low chill
if (rec.WindChill > Cumulus.DefaultHiVal && rec.WindChill < lowWindChill.Value)
if (rec.WindChill < lowWindChill.Value)
{
lowWindChill.Value = rec.WindChill;
lowWindChill.Ts = rec.Date;
}
// hi heat
if (rec.HeatIndex > Cumulus.DefaultHiVal && rec.HeatIndex > highHeatInd.Value)
if (rec.HeatIndex > highHeatInd.Value)
{
highHeatInd.Value = rec.HeatIndex;
highHeatInd.Ts = rec.Date;
Expand Down Expand Up @@ -853,13 +853,10 @@ internal string GetRecordsLogFile(string recordType)
}

// hi/low humidex
if (rec.Humidex > Cumulus.DefaultHiVal)
if (rec.Humidex > highHumidex.Value)
{
if (rec.Humidex > highHumidex.Value)
{
highHumidex.Value = rec.Humidex;
highHumidex.Ts = rec.Date;
}
highHumidex.Value = rec.Humidex;
highHumidex.Ts = rec.Date;
}

// hi temp
Expand Down Expand Up @@ -2321,19 +2318,19 @@ internal string GetMonthlyRecLogFile()
}

// low chill
if (rec.WindChill > -9999 && rec.WindChill < lowWindChill[monthOffset].Value)
if (rec.WindChill < lowWindChill[monthOffset].Value)
{
lowWindChill[monthOffset].Value = rec.WindChill;
lowWindChill[monthOffset].Ts = rec.Date;
}
// hi heat
if (rec.HeatIndex > -9999 && rec.HeatIndex > highHeatInd[monthOffset].Value)
if (rec.HeatIndex > highHeatInd[monthOffset].Value)
{
highHeatInd[monthOffset].Value = rec.HeatIndex;
highHeatInd[monthOffset].Ts = rec.Date;
}

if (rec.ApparentTemperature > -9999)
if (rec.ApparentTemperature > Cumulus.DefaultHiVal)
{
// hi appt
if (rec.ApparentTemperature > highAppTemp[monthOffset].Value)
Expand All @@ -2349,7 +2346,7 @@ internal string GetMonthlyRecLogFile()
}
}

if (rec.FeelsLike > -9999)
if (rec.FeelsLike > Cumulus.DefaultHiVal)
{
// hi feels like
if (rec.FeelsLike > highFeelsLike[monthOffset].Value)
Expand All @@ -2366,7 +2363,7 @@ internal string GetMonthlyRecLogFile()
}

// hi humidex
if (rec.Humidex > -9999 && rec.Humidex > highHumidex[monthOffset].Value)
if (rec.Humidex > highHumidex[monthOffset].Value)
{
highHumidex[monthOffset].Value = rec.Humidex;
highHumidex[monthOffset].Ts = rec.Date;
Expand Down
1 change: 1 addition & 0 deletions CumulusMX/DavisWllStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3258,6 +3258,7 @@ private void GetAvailableSensors()
catch (Exception ex)
{
cumulus.LogDebugMessage("GetAvailableSensors: WeatherLink API exception: " + ex.Message);
return;
}

// Sensor types we are interested in...
Expand Down
6 changes: 3 additions & 3 deletions CumulusMX/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Cumulus MX")]
[assembly: AssemblyDescription("Version 3.22.2 - Build 3213")]
[assembly: AssemblyDescription("Version 3.22.3 - Build 3214")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cumulus MX")]
Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.22.2.3213")]
[assembly: AssemblyFileVersion("3.22.2.3213")]
[assembly: AssemblyVersion("3.22.3.3214")]
[assembly: AssemblyFileVersion("3.22.3.3214")]
9 changes: 5 additions & 4 deletions CumulusMX/StationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,7 @@ internal string FtpNow(IHttpContext context)
{
var data = new StreamReader(context.Request.InputStream).ReadToEnd();
var json = WebUtility.UrlDecode(data);
var now = DateTime.Now;

// Dead simple (dirty), there is only one setting at present!
var includeGraphs = json.Contains("true");
Expand Down Expand Up @@ -1401,15 +1402,15 @@ internal string FtpNow(IHttpContext context)
cumulus.GraphDataFiles[i].CopyRequired = true;
}
cumulus.LogDebugMessage("FTP Now: Re-Generating the graph data files, if required");
station.CreateGraphDataFiles();
station.CreateGraphDataFiles(now);

// (re)generate the daily graph data files, and upload if required
cumulus.LogDebugMessage("FTP Now: Generating the daily graph data files, if required");
station.CreateEodGraphDataFiles();

cumulus.LogMessage("FTP Now: Trying new web update");
cumulus.WebUpdating = 1;
cumulus.ftpThread = new Thread(cumulus.DoHTMLFiles) { IsBackground = true };
cumulus.ftpThread = new Thread(() => cumulus.DoHTMLFiles(now)) { IsBackground = true };
cumulus.ftpThread.Start();
return "An existing FTP process was aborted, and a new FTP process invoked";
}
Expand All @@ -1422,14 +1423,14 @@ internal string FtpNow(IHttpContext context)
cumulus.GraphDataFiles[i].CopyRequired = true;
}
cumulus.LogDebugMessage("FTP Now: Re-Generating the graph data files, if required");
station.CreateGraphDataFiles();
station.CreateGraphDataFiles(now);

// (re)generate the daily graph data files, and upload if required
cumulus.LogDebugMessage("FTP Now: Generating the daily graph data files, if required");
station.CreateEodGraphDataFiles();

cumulus.WebUpdating = 1;
cumulus.ftpThread = new Thread(cumulus.DoHTMLFiles) { IsBackground = true };
cumulus.ftpThread = new Thread(() => cumulus.DoHTMLFiles(now)) { IsBackground = true };
cumulus.ftpThread.Start();
return "FTP process invoked";
}
Expand Down
Loading

0 comments on commit 096c15f

Please sign in to comment.