Skip to content

Commit

Permalink
Merge branch 'v4.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrossley committed Dec 9, 2024
2 parents a2f16a0 + 719721b commit 96bc69b
Show file tree
Hide file tree
Showing 8 changed files with 4,978 additions and 4,919 deletions.
399 changes: 200 additions & 199 deletions .editorconfig

Large diffs are not rendered by default.

23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ Alternatively view it [online on GitHub](https://github.com/cumulusmx/CumulusMX/
---
---

## [4.3.1 \[b4064\]][10] - 2024-12-09

### Changed

- Add weekly rain (rweek) to websitedataT.json

### Fixed

- AWEKAS uploads fix to avoid frequent rate limiting messages
- Ability to edit sunshine hours to two decimal palces in the log and day file editors
- Fix recent Solar graph data bad format if solar or UV sensor data is null
- Add check for CustomHttpXXX URLs to begin with http
- Davis WLL change to avoid potential extension of 10 minute gust values when broadcasts are working
- Bluesky variable timed posts not firing if no timed posts are defined
- Snow graphs now show all days
- Fix Rain Week calculation
- Fix for LoadRecent failing if indoor sensors are absent
- Fix for Tempest stations not reading historic data


## [4.3.0 \[b4063\]][9] - 2024-12-04

### New
Expand Down Expand Up @@ -472,4 +492,5 @@ Initial release of Cumulus MX which now runs under Microsoft .NET 8.0 and remove
[6]: https://github.com/cumulusmx/CumulusMX/releases/tag/b4028
[7]: https://github.com/cumulusmx/CumulusMX/releases/tag/b4039
[8]: https://github.com/cumulusmx/CumulusMX/releases/tag/b4043
[9]: https://github.com/cumulusmx/CumulusMX/releases/tag/b4063
[9]: https://github.com/cumulusmx/CumulusMX/releases/tag/b4063
[10]: https://github.com/cumulusmx/CumulusMX/releases/tag/b4064
228 changes: 131 additions & 97 deletions CumulusMX/Cumulus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,6 @@ public struct MqttConfig
private bool customMySqlRolloverUpdateInProgress;
private bool customMySqlTimedUpdateInProgress;

private bool BlueskyTimedUpdateInProgress;

private HttpFiles httpFiles;

internal AirLinkData airLinkDataIn;
Expand Down Expand Up @@ -12673,7 +12671,7 @@ public void StartTimersAndSensors()

internal async Task BlueskyTimedUpdate(DateTime now)
{
if (station.DataStopped || Bluesky.TimedPostsCount == 0)
if (station.DataStopped)
{
// No data coming in, do not do anything
return;
Expand All @@ -12686,96 +12684,111 @@ internal async Task BlueskyTimedUpdate(DateTime now)
return;
}

if (!BlueskyTimedUpdateInProgress)
// Test if an interval update is due
if (Bluesky.Interval > 0 && (int) now.TimeOfDay.TotalMinutes % Bluesky.Interval == 0)
{
BlueskyTimedUpdateInProgress = true;
LogDebugMessage("BlueskyTimedUpdate: Creating interval post for: " + now.ToString("HH:mm"));

var parser = new TokenParser(TokenParserOnToken)
{
InputText = Bluesky.ContentTemplate
};

await Bluesky.DoUpdate(parser.ToStringFromString());
}

var roundedTime = new TimeSpan(now.Hour, now.Minute, 0);

for (var i = 0; i < Bluesky.TimedPostsTime.Length; i++)
var roundedTime = new TimeSpan(now.Hour, now.Minute, 0);

for (var i = 0; i < Bluesky.TimedPostsTime.Length; i++)
{
try
{
try
if (Bluesky.TimedPostsTime[i] == TimeSpan.MaxValue)
{
if (Bluesky.TimedPostsTime[i] == TimeSpan.MaxValue)
{
continue;
}
continue;
}

// is this the time?
if (Bluesky.TimedPostsTime[i] == roundedTime)
{
string content;
// is this the time?
if (Bluesky.TimedPostsTime[i] == roundedTime)
{
string content;

if (Bluesky.TimedPostsFile[i] == "web\\Bluesky.txt" || Bluesky.TimedPostsFile[i] == "web/Bluesky.txt")
{
content = Bluesky.ContentTemplate;
}
else
{
content = await File.ReadAllTextAsync(Bluesky.TimedPostsFile[i]);
}
var parser = new TokenParser(TokenParserOnToken)
{
InputText = content
};
LogDebugMessage("BlueskyTimedUpdate: Creating timed post for: " + now.ToString("HH:mm"));

await Bluesky.DoUpdate(parser.ToStringFromString());
if (Bluesky.TimedPostsFile[i] == "web\\Bluesky.txt" || Bluesky.TimedPostsFile[i] == "web/Bluesky.txt")
{
content = Bluesky.ContentTemplate;
}
}
catch (Exception ex)
{
LogExceptionMessage(ex, $"BlueskyTimedUpdate[{i}]: Error");
else
{
content = await File.ReadAllTextAsync(Bluesky.TimedPostsFile[i]);
}
var parser = new TokenParser(TokenParserOnToken)
{
InputText = content
};

await Bluesky.DoUpdate(parser.ToStringFromString());
}
}
catch (Exception ex)
{
LogExceptionMessage(ex, $"BlueskyTimedUpdate[{i}]: Error");
}
}

for (var i = 0; i < Bluesky.VariablePostsTime.Length; i++)
for (var i = 0; i < Bluesky.VariablePostsTime.Length; i++)
{
try
{
try
var tim = Bluesky.VariablePostsTime[i] switch
{
var tim = Bluesky.VariablePostsTime[i] switch
{
"sunrise" => SunRiseTime,
"sunset" => SunSetTime,
"dawn" => Dawn,
"dusk" => Dusk,
_ => DateTime.MaxValue
};
"sunrise" => SunRiseTime,
"sunset" => SunSetTime,
"dawn" => Dawn,
"dusk" => Dusk,
_ => DateTime.MaxValue
};


if (tim == DateTime.MaxValue)
{
continue;
}

LogDebugMessage("BlueskyTimedUp: Created variable timed post for: " + Bluesky.VariablePostsTime[i]);

if (tim == DateTime.MaxValue)
if (tim.Hour == roundedTime.Hours && tim.Minute == roundedTime.Minutes)
{
string content;

if (Bluesky.VariablePostsFile[i] == "web\\Bluesky.txt" || Bluesky.VariablePostsFile[i] == "web/Bluesky.txt")
{
continue;
content = Bluesky.ContentTemplate;
}

if (tim.Hour == roundedTime.Hours && tim.Minute == roundedTime.Minutes)
else
{
string content;

if (Bluesky.VariablePostsFile[i] == "web\\Bluesky.txt" || Bluesky.VariablePostsFile[i] == "web/Bluesky.txt")
{
content = Bluesky.ContentTemplate;
}
else
{
content = await File.ReadAllTextAsync(Bluesky.VariablePostsFile[i]);
}
content = await File.ReadAllTextAsync(Bluesky.VariablePostsFile[i]);
}

var parser = new TokenParser(TokenParserOnToken)
{
InputText = content
};
var parser = new TokenParser(TokenParserOnToken)
{
InputText = content
};

await Bluesky.DoUpdate(parser.ToStringFromString());
}
}
catch (Exception ex)
{
LogExceptionMessage(ex, $"BlueskyVariableUpdate[{i}]: Error");
await Bluesky.DoUpdate(parser.ToStringFromString());
}
}
catch (FileNotFoundException)
{
LogWarningMessage("Bluesky variable timed post failed to find the template file: " + Bluesky.VariablePostsFile[i]);
}
catch (Exception ex)
{
LogExceptionMessage(ex, $"BlueskyVariableUpdate[{i}]: Error");
}
}

BlueskyTimedUpdateInProgress = false;
}

private async void CustomMysqlSecondsTimerTick(object sender, ElapsedEventArgs e)
Expand Down Expand Up @@ -13655,17 +13668,24 @@ public async Task CustomHttpSecondsUpdate()
{
if (!string.IsNullOrEmpty(CustomHttpSecondsStrings[i]))
{
var parser = new TokenParser(TokenParserOnToken)
if (CustomHttpSecondsStrings[i].StartsWith("http", StringComparison.OrdinalIgnoreCase))
{
InputText = CustomHttpSecondsStrings[i]
};
var processedString = parser.ToStringFromString();
LogDebugMessage($"CustomHttpSeconds[{i}]: Querying - {processedString}");
using var response = await MyHttpClient.GetAsync(processedString);
response.EnsureSuccessStatusCode();
var responseBodyAsText = await response.Content.ReadAsStringAsync();
LogDebugMessage($"CustomHttpSeconds[{i}]: Response - {response.StatusCode}");
LogDataMessage($"CustomHttpSeconds[{i}]: Response Text - {responseBodyAsText}");
var parser = new TokenParser(TokenParserOnToken)
{
InputText = CustomHttpSecondsStrings[i]
};
var processedString = parser.ToStringFromString();
LogDebugMessage($"CustomHttpSeconds[{i}]: Querying - {processedString}");
using var response = await MyHttpClient.GetAsync(processedString);
response.EnsureSuccessStatusCode();
var responseBodyAsText = await response.Content.ReadAsStringAsync();
LogDebugMessage($"CustomHttpSeconds[{i}]: Response - {response.StatusCode}");
LogDataMessage($"CustomHttpSeconds[{i}]: Response Text - {responseBodyAsText}");
}
else
{
Cumulus.LogConsoleMessage($"CustomHttpSeconds[{i}]: Invalid URL - {CustomHttpSecondsStrings[i]}");
}
}
}
catch (Exception ex)
Expand Down Expand Up @@ -13694,16 +13714,23 @@ public async Task CustomHttpMinutesUpdate()
{
if (!string.IsNullOrEmpty(CustomHttpMinutesStrings[i]))
{
var parser = new TokenParser(TokenParserOnToken)
if (CustomHttpMinutesStrings[i].StartsWith("http", StringComparison.OrdinalIgnoreCase))
{
InputText = CustomHttpMinutesStrings[i]
};
var processedString = parser.ToStringFromString();
LogDebugMessage($"CustomHttpMinutes[{i}]: Querying - {processedString}");
using var response = await MyHttpClient.GetAsync(processedString);
var responseBodyAsText = await response.Content.ReadAsStringAsync();
LogDebugMessage($"CustomHttpMinutes[{i}]: Response code - {response.StatusCode}");
LogDataMessage($"CustomHttpMinutes[{i}]: Response text - {responseBodyAsText}");
var parser = new TokenParser(TokenParserOnToken)
{
InputText = CustomHttpMinutesStrings[i]
};
var processedString = parser.ToStringFromString();
LogDebugMessage($"CustomHttpMinutes[{i}]: Querying - {processedString}");
using var response = await MyHttpClient.GetAsync(processedString);
var responseBodyAsText = await response.Content.ReadAsStringAsync();
LogDebugMessage($"CustomHttpMinutes[{i}]: Response code - {response.StatusCode}");
LogDataMessage($"CustomHttpMinutes[{i}]: Response text - {responseBodyAsText}");
}
else
{
Cumulus.LogConsoleMessage($"CustomHttpMinutes[{i}]: Invalid URL - {CustomHttpMinutesStrings[i]}");
}
}
}
catch (Exception ex)
Expand All @@ -13728,16 +13755,23 @@ public async Task CustomHttpRolloverUpdate()
{
if (!string.IsNullOrEmpty(CustomHttpRolloverStrings[i]))
{
var parser = new TokenParser(TokenParserOnToken)
if (!string.IsNullOrEmpty(CustomHttpRolloverStrings[i]))
{
InputText = CustomHttpRolloverStrings[i]
};
var processedString = parser.ToStringFromString();
LogDebugMessage($"CustomHttpRollover[{i}]: Querying - {processedString}");
using var response = await MyHttpClient.GetAsync(processedString);
var responseBodyAsText = await response.Content.ReadAsStringAsync();
LogDebugMessage($"CustomHttpRollover[{i}]: Response code - {response.StatusCode}");
LogDataMessage($"CustomHttpRollover[{i}]: Response text - {responseBodyAsText}");
var parser = new TokenParser(TokenParserOnToken)
{
InputText = CustomHttpRolloverStrings[i]
};
var processedString = parser.ToStringFromString();
LogDebugMessage($"CustomHttpRollover[{i}]: Querying - {processedString}");
using var response = await MyHttpClient.GetAsync(processedString);
var responseBodyAsText = await response.Content.ReadAsStringAsync();
LogDebugMessage($"CustomHttpRollover[{i}]: Response code - {response.StatusCode}");
LogDataMessage($"CustomHttpRollover[{i}]: Response text - {responseBodyAsText}");
}
}
else
{
Cumulus.LogConsoleMessage($"CustomHttpRollover[{i}]: Invalid URL - {CustomHttpRolloverStrings[i]}");
}
}
catch (Exception ex)
Expand Down
Loading

0 comments on commit 96bc69b

Please sign in to comment.