Skip to content

Commit

Permalink
Merge pull request #111 from mcrossley/master
Browse files Browse the repository at this point in the history
v3.11.1
  • Loading branch information
mcrossley authored May 8, 2021
2 parents 1baabb6 + 984b576 commit 810b227
Show file tree
Hide file tree
Showing 16 changed files with 88 additions and 12 deletions.
11 changes: 9 additions & 2 deletions CumulusMX/AlarmSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,16 @@ public string TestEmail(IHttpContext context)
}
}

cumulus.emailer.SendTestEmail(dest, from, "Cumulus MX Test Email", "A test email from Cumulus MX.", result.useHtml);
var ret = cumulus.emailer.SendTestEmail(dest, from, "Cumulus MX Test Email", "A test email from Cumulus MX.", result.useHtml);

cumulus.LogMessage("Test email sent without error");
if (ret == "OK")
{
cumulus.LogMessage("Test email sent without error");
}
else
{
return ret;
}
}
catch (Exception ex)
{
Expand Down
2 changes: 2 additions & 0 deletions CumulusMX/CalibrationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public string GetAlpacaFormData()

var data = new JsonCalibrationSettingsData()
{
accessible = cumulus.ProgramOptions.EnableAccessibility,
offsets = offsets,
multipliers = multipliers,
spikeremoval = spikeremoval,
Expand Down Expand Up @@ -198,6 +199,7 @@ public string GetAlpacaFormSchema()

public class JsonCalibrationSettingsData
{
public bool accessible { get; set; }
public JsonCalibrationSettingsOffsets offsets { get; set; }
public JsonCalibrationSettingsMultipliers multipliers { get; set; }
public JsonCalibrationSettingsSpikeRemoval spikeremoval { get; set; }
Expand Down
5 changes: 5 additions & 0 deletions CumulusMX/Cumulus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using Timer = System.Timers.Timer;
using SQLite;
using Renci.SshNet;
using FluentFTP.Helpers;

namespace CumulusMX
{
Expand Down Expand Up @@ -3498,6 +3499,7 @@ private void ReadIniFile()
}
}

ProgramOptions.EnableAccessibility = ini.GetValue("Program", "EnableAccessibility", false);
ProgramOptions.StartupPingHost = ini.GetValue("Program", "StartupPingHost", "");
ProgramOptions.StartupPingEscapeTime = ini.GetValue("Program", "StartupPingEscapeTime", 999);
ProgramOptions.StartupDelaySecs = ini.GetValue("Program", "StartupDelaySecs", 0);
Expand Down Expand Up @@ -4550,6 +4552,8 @@ internal void WriteIniFile()

IniFile ini = new IniFile("Cumulus.ini");

ini.SetValue("Program", "EnableAccessibility", ProgramOptions.EnableAccessibility);

ini.SetValue("Program", "StartupPingHost", ProgramOptions.StartupPingHost);
ini.SetValue("Program", "StartupPingEscapeTime", ProgramOptions.StartupPingEscapeTime);

Expand Down Expand Up @@ -9401,6 +9405,7 @@ public class DiaryData

public class ProgramOptionsClass
{
public bool EnableAccessibility { get; set; }
public string StartupPingHost { get; set; }
public int StartupPingEscapeTime { get; set; }
public int StartupDelaySecs { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions CumulusMX/CumulusMX.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@
<Reference Include="BouncyCastle.Crypto, Version=1.8.10.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.10\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="FluentFTP, Version=33.1.5.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
<HintPath>..\packages\FluentFTP.33.1.5\lib\net45\FluentFTP.dll</HintPath>
<Reference Include="FluentFTP, Version=32.3.1.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
<HintPath>..\packages\FluentFTP.32.3.1\lib\net45\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="HidSharp, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HidSharp.2.1.0\lib\net35\HidSharp.dll</HintPath>
Expand Down
10 changes: 8 additions & 2 deletions CumulusMX/EmailSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ public async void SendEmail(string[] to, string from, string subject, string mes
}
}

public void SendTestEmail(string[] to, string from, string subject, string message, bool isHTML)
public string SendTestEmail(string[] to, string from, string subject, string message, bool isHTML)
{
string retVal;

try
{
cumulus.LogDebugMessage($"SendEmail: Waiting for lock...");
Expand Down Expand Up @@ -128,17 +130,21 @@ public void SendTestEmail(string[] to, string from, string subject, string messa
client.Send(m);
client.Disconnect(true);
}

retVal = "OK";
}
catch (Exception e)
{
cumulus.LogMessage("SendEmail: Error - " + e);

retVal = e.Message;
}
finally
{
cumulus.LogDebugMessage($"SendEmail: Releasing lock...");
_writeLock.Release();
}

return retVal;
}


Expand Down
2 changes: 2 additions & 0 deletions CumulusMX/ExtraSensorSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public string GetAlpacaFormData()

var data = new JsonExtraSensorSettings()
{
accessible = cumulus.ProgramOptions.EnableAccessibility,
airquality = aq,
airLink = airlink,
blakeLarsen = bl,
Expand Down Expand Up @@ -257,6 +258,7 @@ public string GetAlpacaFormSchema()

public class JsonExtraSensorSettings
{
public bool accessible { get; set; }
public JsonExtraSensorAirQuality airquality { get; set; }
public JsonExtraSensorAirLinkSettings airLink { get; set; }
public JsonExtraSensorBlakeLarsen blakeLarsen { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions CumulusMX/InternetSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ public string GetAlpacaFormData()

var data = new JsonInternetSettingsData()
{
accessible = cumulus.ProgramOptions.EnableAccessibility,
website = websitesettings,
websettings = websettings,
externalprograms = externalprograms,
Expand Down Expand Up @@ -618,6 +619,7 @@ public string UpdateExtraWebFiles(IHttpContext context)

public class JsonInternetSettingsData
{
public bool accessible { get; set; }
public JsonInternetSettingsWebsite website { get; set; }
public JsonInternetSettingsWebSettings websettings { get; set; }
public JsonInternetSettingsExternalPrograms externalprograms { get; set; }
Expand Down
4 changes: 3 additions & 1 deletion CumulusMX/MysqlSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public string GetAlpacaFormData()

var data = new JsonMysqlSettings()
{
accessible = cumulus.ProgramOptions.EnableAccessibility,
server = server,
monthenabled = cumulus.MonthlyMySqlEnabled,
monthly = monthly,
Expand Down Expand Up @@ -241,7 +242,7 @@ private string CreateMySQLTable(string createSQL)
using (MySqlCommand cmd = new MySqlCommand(createSQL, mySqlConn))
{
cumulus.LogMessage($"MySQL Create Table: {createSQL}");

try
{
mySqlConn.Open();
Expand Down Expand Up @@ -295,6 +296,7 @@ public string CreateRealtimeSQL(IHttpContext context)

public class JsonMysqlSettings
{
public bool accessible {get; set;}
public JsonMysqlSettingsServer server { get; set; }
public bool monthenabled { get; set; }
public JsonMysqlSettingsMonthly monthly { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions CumulusMX/NOAASettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public string GetAlpacaFormData()

var data = new JsonNOAASettingsData()
{
accessible = cumulus.ProgramOptions.EnableAccessibility,
autosave = cumulus.NOAAAutoSave,

sitedetails = site,
Expand Down Expand Up @@ -234,6 +235,7 @@ public string UpdateConfig(IHttpContext context)

public class JsonNOAASettingsData
{
public bool accessible { get; set; }
public bool autosave {get; set; }
public JsonNOAASettingsSite sitedetails { get; set; }
public JsonNOAASettingsOutput outputfiles { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions CumulusMX/ProgramSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public string GetAlpacaFormData()

var settings = new JsonProgramSettings()
{
accessible = cumulus.ProgramOptions.EnableAccessibility,
startup = startup,
options = options
};
Expand Down Expand Up @@ -101,6 +102,7 @@ public string UpdateConfig(IHttpContext context)
// process the settings
try
{
cumulus.ProgramOptions.EnableAccessibility = settings.accessible;
cumulus.ProgramOptions.StartupPingHost = settings.startup.startuphostping;
cumulus.ProgramOptions.StartupPingEscapeTime = settings.startup.startuppingescape;
cumulus.ProgramOptions.StartupDelaySecs = settings.startup.startupdelay;
Expand Down Expand Up @@ -134,6 +136,7 @@ public string UpdateConfig(IHttpContext context)

public class JsonProgramSettings
{
public bool accessible { get; set; }
public JsonProgramSettingsStartupOptions startup { get; set; }
public JsonProgramSettingsGeneralOptions options { get; set; }
}
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.11.0 - Build 3129")]
[assembly: AssemblyDescription("Version 3.11.1 - Build 3130")]
[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.11.0.3129")]
[assembly: AssemblyFileVersion("3.11.0.3129")]
[assembly: AssemblyVersion("3.11.1.3130")]
[assembly: AssemblyFileVersion("3.11.1.3130")]
16 changes: 16 additions & 0 deletions CumulusMX/StationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ internal string GetAlpacaFormData()

var data = new JsonStationSettingsData()
{
accessible = cumulus.ProgramOptions.EnableAccessibility,
stationid = cumulus.StationType,
general = general,
davisvp2 = davisvp2,
Expand Down Expand Up @@ -1030,6 +1031,20 @@ internal string UpdateConfig(IHttpContext context)
context.Response.StatusCode = 500;
}

// Accessible
try
{
cumulus.ProgramOptions.EnableAccessibility = settings.accessible;
}
catch (Exception ex)
{
var msg = "Error processing Accessibility setting: " + ex.Message;
cumulus.LogMessage(msg);
errorMsg += msg + "\n\n";
context.Response.StatusCode = 500;
}


// Save the settings
cumulus.WriteIniFile();

Expand Down Expand Up @@ -1176,6 +1191,7 @@ internal string GetVersion()

internal class JsonStationSettingsData
{
public bool accessible { get; set; }
public int stationid { get; set; }
public JsonStationGeneral general { get; set; }
public JsonStationSettingsDavisVp2 davisvp2 { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions CumulusMX/ThirdPartySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ public string GetAlpacaFormData()

var data = new JsonThirdPartySettings()
{
accessible = cumulus.ProgramOptions.EnableAccessibility,
twitter = twittersettings,
wunderground = wusettings,
windy = windysettings,
Expand Down Expand Up @@ -526,6 +527,7 @@ public string GetAlpacaFormSchema()

public class JsonThirdPartySettings
{
public bool accessible { get; set; }
public JsonThirdPartySettingsTwitterSettings twitter { get; set; }
public JsonThirdPartySettingsWunderground wunderground { get; set; }
public JsonThirdPartySettingsWindy windy { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion CumulusMX/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EmbedIO" version="2.1.1" targetFramework="net452" />
<package id="FluentFTP" version="33.1.5" targetFramework="net452" />
<package id="FluentFTP" version="32.3.1" targetFramework="net452" />
<package id="HidSharp" version="2.1.0" targetFramework="net452" />
<package id="linqtotwitter" version="3.1.1" targetFramework="net45" />
<package id="MailKit" version="2.11.1" targetFramework="net452" />
Expand Down
9 changes: 8 additions & 1 deletion CumulusMX/webtags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,17 @@ private string Tagpresstrendval(Dictionary<string,string> tagParams)
return CheckRcDp(station.presstrendval, tagParams, cumulus.PressDPlaces);
}

private string TagTempChangeLastHour(Dictionary<string,string> tagParams)
private string TagPressChangeLast3Hours(Dictionary<string,string> tagParams)
{
return CheckRcDp(station.presstrendval * 3, tagParams, cumulus.PressDPlaces);
}

private string TagTempChangeLastHour(Dictionary<string, string> tagParams)
{
return CheckRc(station.TempChangeLastHour.ToString("+##0.0;-##0.0;0"), tagParams);
}


private string Tagdew(Dictionary<string,string> tagParams)
{
return CheckRcDp(station.OutdoorDewpoint, tagParams, cumulus.TempDPlaces);
Expand Down Expand Up @@ -5139,6 +5145,7 @@ public void InitialiseWebtags()
{ "dew", Tagdew },
{ "wetbulb", Tagwetbulb },
{ "presstrendval", Tagpresstrendval },
{ "PressChangeLast3Hours", TagPressChangeLast3Hours },
{ "windrunY", TagwindrunY },
{ "domwindbearingY", TagdomwindbearingY },
{ "domwinddirY", TagdomwinddirY },
Expand Down
20 changes: 20 additions & 0 deletions Updates.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
3.11.1 - b3130
——————————————
- Fix: Fix Test email logging "success" on failure
- Fix: Rollback FluentFTP package to previous 32.3.1 version due to crashes in Mono with newer versions

- New: Pressure change in last 3 hours web tag - <#PressChangeLast3Hours>
- New: Enable additional Accessibility feature - configured via either Station Settings or Program Settings
The following pages now have some enhanced accessibility features:
- Program Settings
- Station Settings
- Internet Settings
- Third Party Settings
- Extra Sensor Settings
- Calibration Settings
- NOAA Settings
- MySQL Settings
Adds a new entry in Cumulus.ini



3.11.0 - b3129
——————————————
- Fix: Remove THW Index in /web/websitedataT.json, and default web site index.htm
Expand Down

0 comments on commit 810b227

Please sign in to comment.