From 939466152069e3390b89b2923e49b92696532e05 Mon Sep 17 00:00:00 2001 From: Mark Crossley <1196094+mcrossley@users.noreply.github.com> Date: Thu, 25 Mar 2021 10:25:32 +0000 Subject: [PATCH 1/6] Adds GW1000 main sensor type detection --- CumulusMX/GW1000Station.cs | 177 ++++++++++++++++++--------- CumulusMX/Properties/AssemblyInfo.cs | 6 +- Updates.txt | 5 + 3 files changed, 125 insertions(+), 63 deletions(-) diff --git a/CumulusMX/GW1000Station.cs b/CumulusMX/GW1000Station.cs index 523c2f1a..0144f757 100644 --- a/CumulusMX/GW1000Station.cs +++ b/CumulusMX/GW1000Station.cs @@ -30,6 +30,8 @@ internal class GW1000Station : WeatherStation private Version fwVersion; + private string mainSensor; + private enum Commands : byte { // General order CMD_WRITE_SSID = 0x11,// send router SSID and Password to wifi module @@ -277,6 +279,8 @@ public GW1000Station(Cumulus cumulus) : base(cumulus) var fwString = GW1000FirmwareVersion.Split(new string[] { "_V" }, StringSplitOptions.None); fwVersion = new Version(fwString[1]); + GetSystemInfo(); + GetSensorIdsNew(); } @@ -614,6 +618,7 @@ private string GetFirmwareVersion() return response; } + /* private bool GetSensorIds() { cumulus.LogMessage("Reading sensor ids"); @@ -647,6 +652,43 @@ private bool GetSensorIds() } } + private void PrintSensorInfo(byte[] data, int idx) + { + // expected response + // 0 - 0xff - header + // 1 - 0xff - header + // 2 - 0x3A - sensor id command + // 3 - 0x?? - size of response + // 4 - wh65 + // 5-8 - wh65 id + // 9 - wh65 signal + // 10 - wh65 battery + // 11 - wh68 + // ... etc + // (??) - 0x?? - checksum + + var id = ConvertBigEndianUInt32(data, idx + 1); + var type = Enum.GetName(typeof(SensorIds), data[idx]).ToUpper(); + + if (string.IsNullOrEmpty(type)) + { + type = $"unknown type = {id}"; + } + switch (id) + { + case 0xFFFFFFFE: + cumulus.LogDebugMessage($" - {type} sensor = disabled"); + break; + case 0xFFFFFFFF: + cumulus.LogDebugMessage($" - {type} sensor = registering"); + break; + default: + cumulus.LogDebugMessage($" - {type} sensor id = {id} signal = {data[idx+5]} battery = {data[idx+6]}"); + break; + } + } + */ + private bool GetSensorIdsNew() { cumulus.LogMessage("Reading sensor ids"); @@ -689,41 +731,6 @@ private bool GetSensorIdsNew() return false; } } - private void PrintSensorInfo(byte[] data, int idx) - { - // expected response - // 0 - 0xff - header - // 1 - 0xff - header - // 2 - 0x3A - sensor id command - // 3 - 0x?? - size of response - // 4 - wh65 - // 5-8 - wh65 id - // 9 - wh65 signal - // 10 - wh65 battery - // 11 - wh68 - // ... etc - // (??) - 0x?? - checksum - - var id = ConvertBigEndianUInt32(data, idx + 1); - var type = Enum.GetName(typeof(SensorIds), data[idx]); - - if (string.IsNullOrEmpty(type)) - { - type = $"unknown type = {id}"; - } - switch (id) - { - case 0xFFFFFFFE: - cumulus.LogDebugMessage($" - {type} sensor = disabled"); - break; - case 0xFFFFFFFF: - cumulus.LogDebugMessage($" - {type} sensor = registering"); - break; - default: - cumulus.LogDebugMessage($" - {type} sensor id = {id} signal = {data[idx+5]} battery = {data[idx+6]}"); - break; - } - } private bool PrintSensorInfoNew(byte[] data, int idx) { @@ -741,7 +748,7 @@ private bool PrintSensorInfoNew(byte[] data, int idx) // (??) - 0x?? - checksum var id = ConvertBigEndianUInt32(data, idx + 1); - var type = Enum.GetName(typeof(SensorIds), data[idx]); + var type = Enum.GetName(typeof(SensorIds), data[idx]).ToUpper(); var battPos = idx + 5; var sigPos = idx + 6; var batteryLow = false; @@ -749,6 +756,12 @@ private bool PrintSensorInfoNew(byte[] data, int idx) { type = $"unknown type = {id}"; } + // Wh65 could be a Wh65 or a Wh24, we found out using the System Info command + if (type == "WH65") + { + type = mainSensor; + } + switch (id) { case 0xFFFFFFFE: @@ -765,30 +778,31 @@ private bool PrintSensorInfoNew(byte[] data, int idx) string batt; switch (type) { - case "Wh65": - case "Wh40": - case "Wh26": + case "WH65": + case "WH24": + case "WH40": + case "WH26": batt = TestBattery1(data[battPos], 1); // 0 or 1 break; - case "Wh68": - case "Wh80": - case string wh34 when wh34.StartsWith("Wh34"): // ch 1-8 - case string wh35 when wh35.StartsWith("Wh35"): // ch 1-8 + case "WH68": + case "WH80": + case string wh34 when wh34.StartsWith("WH34"): // ch 1-8 + case string wh35 when wh35.StartsWith("WH35"): // ch 1-8 double battV = data[battPos] * 0.02; batt = $"{battV:f1}V ({TestBattery4S(data[battPos])})"; // volts, low = 1.2V break; - case string wh31 when wh31.StartsWith("Wh31"): // ch 1-8 - case string wh51 when wh51.StartsWith("Wh51"): // ch 1-8 + case string wh31 when wh31.StartsWith("WH31"): // ch 1-8 + case string wh51 when wh51.StartsWith("WH51"): // ch 1-8 batt = $"{data[battPos]} ({TestBattery1(data[battPos], 1)})"; break; - case "Wh25": - case "Wh45": - case "Wh57": - case string wh41 when wh41.StartsWith("Wh41"): // ch 1-4 - case string wh55 when wh55.StartsWith("Wh55"): // ch 1-4 + case "WH25": + case "WH45": + case "WH57": + case string wh41 when wh41.StartsWith("WH41"): // ch 1-4 + case string wh55 when wh55.StartsWith("WH55"): // ch 1-4 batt = $"{data[battPos]} ({TestBattery3(data[battPos])})"; // 0-5, low = 1 break; @@ -1110,20 +1124,29 @@ private void GetLiveData() chan /= 2; // -> 1,2,3,4... tempInt16 = ConvertBigEndianInt16(data, idx); DoUserTemp(ConvertTempCToUser(tempInt16 / 10.0), chan); - if (tenMinuteChanged) + + // Firmware version 1.5.9 uses 2 data bytes, 1.6.0+ uses 3 data bytes + if (fwVersion.CompareTo(new Version("1.6.0")) >= 0) { - var volts = TestBattery4V(data[idx + 2]); - if (volts <= 1.2) - { - batteryLow = true; - cumulus.LogMessage($"WH34 channel #{chan} battery LOW = {volts}V"); - } - else + if (tenMinuteChanged) { - cumulus.LogDebugMessage($"WH34 channel #{chan} battery OK = {volts}V"); + var volts = TestBattery4V(data[idx + 2]); + if (volts <= 1.2) + { + batteryLow = true; + cumulus.LogMessage($"WH34 channel #{chan} battery LOW = {volts}V"); + } + else + { + cumulus.LogDebugMessage($"WH34 channel #{chan} battery OK = {volts}V"); + } } + idx += 3; + } + else + { + idx += 2; } - idx += 3; // Firmware version 1.5.9 uses 2 data bytes, 1.6.0+ uses 3 data bytes break; case 0x6B: //WH34 User temperature battery (8 channels) - No longer used in firmware 1.6.0+ if (tenMinuteChanged) @@ -1256,6 +1279,40 @@ private void GetLiveData() } } + private void GetSystemInfo() + { + cumulus.LogMessage("Reading GW1000 system info"); + + var data = DoCommand((byte)Commands.CMD_READ_SSSS); + + // expected response + // 0 - 0xff - header + // 1 - 0xff - header + // 2 - 0x30 - system info + // 3 - 0x?? - size of response + // 4 - frequency - 0=433, 1=868MHz + // 5 - sensor type - 0=WH24, 1=WH65 + // 6-9 - UTC time + // 10 - timezone index (?) + // 11 - DST 0-1 - false/true + // 12 - 0x?? - checksum + + if (data.Length != 13) + { + cumulus.LogMessage("Unexpected response to Sysetm Info!"); + return; + } + + var freq = data[4] == 0 ? "433MHz" : "868MHz"; + mainSensor = data[5] == 0 ? "WH24" : "WH65"; + + var unix = ConvertBigEndianUInt32(data, 6); + var date = Utils.FromUnixTime(unix); + var dst = data[11] != 0; + + cumulus.LogMessage($"GW1000 Info: freqency: {freq}, main sensor: {mainSensor}, date/time: {date:F}, Automatic DST adjustment: {dst}"); + } + private byte[] DoCommand(byte command) { var buffer = new byte[2028]; diff --git a/CumulusMX/Properties/AssemblyInfo.cs b/CumulusMX/Properties/AssemblyInfo.cs index f024ee84..a223af94 100644 --- a/CumulusMX/Properties/AssemblyInfo.cs +++ b/CumulusMX/Properties/AssemblyInfo.cs @@ -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.10.4 - Build 3121")] +[assembly: AssemblyDescription("Version 3.10.5 - Build 3122")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Cumulus MX")] @@ -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.10.4.3121")] -[assembly: AssemblyFileVersion("3.10.4.3121")] +[assembly: AssemblyVersion("3.10.5.3122")] +[assembly: AssemblyFileVersion("3.10.5.3122")] diff --git a/Updates.txt b/Updates.txt index c4b65530..607857f0 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,3 +1,8 @@ +3.10.5 - b3122 +—————————————— +- New: Now determines the Ecowitt GW1000 device main sensor type (WH65/WH24) and prints system information to the log file + + 3.10.4 - b3121 —————————————— - Fix: Issue introduced in v3.10.3 decoding Ecowitt live data From 245c0a2aaf580e0006157ff85628fa8b821828c2 Mon Sep 17 00:00:00 2001 From: Mark Crossley <1196094+mcrossley@users.noreply.github.com> Date: Thu, 25 Mar 2021 11:34:03 +0000 Subject: [PATCH 2/6] Add Station Model to the station settng page --- CumulusMX/StationSettings.cs | 3 +++ Updates.txt | 1 + 2 files changed, 4 insertions(+) diff --git a/CumulusMX/StationSettings.cs b/CumulusMX/StationSettings.cs index 24caea27..355d3088 100644 --- a/CumulusMX/StationSettings.cs +++ b/CumulusMX/StationSettings.cs @@ -364,6 +364,7 @@ internal string GetStationAlpacaFormData() var general = new JsonStationGeneral() { stationtype = cumulus.StationType, + stationmodel = cumulus.StationModel, loginterval = cumulus.DataLogInterval, logrollover = logrollover, units = units, @@ -936,6 +937,7 @@ internal string UpdateStationConfig(IHttpContext context) cumulus.LogConsoleMessage("*** Station type changed, restart required ***"); } cumulus.StationType = settings.general.stationtype; + cumulus.StationModel = settings.general.stationmodel; } catch (Exception ex) { @@ -1110,6 +1112,7 @@ internal class JsonStationSettingsData internal class JsonStationGeneral { public int stationtype { get; set; } + public string stationmodel { get; set; } public int loginterval { get; set; } public JsonStationSettingsLogRollover logrollover { get; set; } public JsonStationSettingsUnits units { get; set; } diff --git a/Updates.txt b/Updates.txt index 607857f0..12dc65f4 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,6 +1,7 @@ 3.10.5 - b3122 —————————————— - New: Now determines the Ecowitt GW1000 device main sensor type (WH65/WH24) and prints system information to the log file +- New: Adds the free text station model to the Station settings page 3.10.4 - b3121 From 0b992c7a389b2b17488463433da8a1a73257beff Mon Sep 17 00:00:00 2001 From: Mark Crossley <1196094+mcrossley@users.noreply.github.com> Date: Thu, 25 Mar 2021 15:49:28 +0000 Subject: [PATCH 3/6] More upload API comma decimal fixes --- CumulusMX/WeatherStation.cs | 272 +++++++++++++++++++----------------- CumulusMX/webtags.cs | 4 + Updates.txt | 3 + 3 files changed, 151 insertions(+), 128 deletions(-) diff --git a/CumulusMX/WeatherStation.cs b/CumulusMX/WeatherStation.cs index 4eefa907..5c0283ef 100644 --- a/CumulusMX/WeatherStation.cs +++ b/CumulusMX/WeatherStation.cs @@ -8555,8 +8555,92 @@ public string GetAwekasURLv4(out string pwstring, DateTime timestamp) else AvgTemp = 0; - StringBuilder sb = new StringBuilder("http://data.awekas.at/eingabe_pruefung.php?val="); - // val + StringBuilder sb = new StringBuilder("http://data.awekas.at/eingabe_pruefung.php?"); + + var started = false; + + // indoor temp/humidity + if (cumulus.AWEKAS.SendIndoor) + { + sb.Append("indoortemp=" + ConvertUserTempToC(IndoorTemperature).ToString("F1", InvC)); + sb.Append("&indoorhumidity=" + IndoorHumidity); + started = true; + } + + if (cumulus.AWEKAS.SendSoilTemp) + { + if (started) sb.Append("&"); else started = true; + sb.Append("soiltemp1=" + ConvertUserTempToC(SoilTemp1).ToString("F1", InvC)); + sb.Append("&soiltemp2=" + ConvertUserTempToC(SoilTemp2).ToString("F1", InvC)); + sb.Append("&soiltemp3=" + ConvertUserTempToC(SoilTemp3).ToString("F1", InvC)); + sb.Append("&soiltemp4=" + ConvertUserTempToC(SoilTemp4).ToString("F1", InvC)); + } + + if (cumulus.AWEKAS.SendSoilMoisture) + { + if (started) sb.Append("&"); else started = true; + sb.Append("soilmoisture1=" + SoilMoisture1); + sb.Append("&soilmoisture2=" + SoilMoisture2); + sb.Append("&soilmoisture3=" + SoilMoisture3); + sb.Append("&soilmoisture4=" + SoilMoisture4); + } + + if (cumulus.AWEKAS.SendLeafWetness) + { + if (started) sb.Append("&"); else started = true; + sb.Append("leafwetness1=" + LeafWetness1); + sb.Append("&leafwetness2=" + LeafWetness2); + sb.Append("&leafwetness3=" + LeafWetness3); + sb.Append("&leafwetness4=" + LeafWetness4); + } + + if (cumulus.AWEKAS.SendAirQuality) + { + if (started) sb.Append("&"); else started = true; + + switch (cumulus.StationOptions.PrimaryAqSensor) + { + case (int)Cumulus.PrimaryAqSensor.AirLinkOutdoor: + if (cumulus.airLinkDataOut != null) + { + sb.Append($"AqPM1={cumulus.airLinkDataOut.pm1.ToString("F1", InvC)}"); + sb.Append($"&AqPM2.5={cumulus.airLinkDataOut.pm2p5.ToString("F1", InvC)}"); + sb.Append($"&AqPM10={cumulus.airLinkDataOut.pm10.ToString("F1", InvC)}"); + sb.Append($"&AqPM2.5_avg_24h={cumulus.airLinkDataOut.pm2p5_24hr.ToString("F1", InvC)}"); + sb.Append($"&AqPM10_avg_24h={cumulus.airLinkDataOut.pm10_24hr.ToString("F1", InvC)}"); + } + break; + case (int)Cumulus.PrimaryAqSensor.Ecowitt1: + sb.Append($"AqPM2.5={AirQuality1.ToString("F1", InvC)}"); + sb.Append($"&AqPM2.5_avg_24h={AirQualityAvg1.ToString("F1", InvC)}"); + break; + case (int)Cumulus.PrimaryAqSensor.Ecowitt2: + sb.Append($"AqPM2.5={AirQuality2.ToString("F1", InvC)}"); + sb.Append($"&AqPM2.5_avg_24h={AirQualityAvg2.ToString("F1", InvC)}"); + break; + case (int)Cumulus.PrimaryAqSensor.Ecowitt3: + sb.Append($"AqPM2.5={AirQuality3.ToString("F1", InvC)}"); + sb.Append($"&AqPM2.5_avg_24h={AirQualityAvg3.ToString("F1", InvC)}"); + break; + case (int)Cumulus.PrimaryAqSensor.Ecowitt4: + sb.Append($"AqPM2.5={AirQuality4.ToString("F1", InvC)}"); + sb.Append($"&AqPM2.5_avg_24h={AirQualityAvg4.ToString("F1", InvC)}"); + break; + case (int)Cumulus.PrimaryAqSensor.EcowittCO2: + sb.Append($"AqPM2.5={CO2_pm2p5.ToString("F1", InvC)}"); + sb.Append($"&AqPM2.5_avg_24h={CO2_pm2p5_24h.ToString("F1", InvC)}"); + sb.Append($"&AqPM10={CO2_pm10.ToString("F1", InvC)}"); + sb.Append($"&AqPM10_avg_24h={CO2_pm10_24h.ToString("F1", InvC)}"); + break; + } + } + + if (started) sb.Append("&"); + sb.Append("output=json&val="); + + // + // Start of val + // sb.Append(cumulus.AWEKAS.ID + sep); // 1 sb.Append(pwstring + sep); // 2 sb.Append(timestamp.ToString("dd'.'MM'.'yyyy';'HH':'mm") + sep); // 3 + 4 @@ -8672,80 +8756,9 @@ public string GetAwekasURLv4(out string pwstring, DateTime timestamp) sb.Append(sep + sep + sep + sep + sep + sep); // 95/96/97/98/99/100 avg/max lux today/month/year sb.Append(sep + sep); // 101/102 sun hours this month/year sb.Append(sep + sep + sep + sep + sep + sep + sep + sep + sep); // 103-111 min/avg/max Soil temp today/month/year - - // End of fixed structure - - // indoor temp/humidity - if (cumulus.AWEKAS.SendIndoor) - { - sb.Append("&indoortemp=" + ConvertUserTempToC(IndoorTemperature).ToString("F1", InvC)); - sb.Append("&indoorhumidity=" + IndoorHumidity); - } - - if (cumulus.AWEKAS.SendSoilTemp) - { - sb.Append("&soiltemp1=" + ConvertUserTempToC(SoilTemp1).ToString("F1", InvC)); - sb.Append("&soiltemp2=" + ConvertUserTempToC(SoilTemp2).ToString("F1", InvC)); - sb.Append("&soiltemp3=" + ConvertUserTempToC(SoilTemp3).ToString("F1", InvC)); - sb.Append("&soiltemp4=" + ConvertUserTempToC(SoilTemp4).ToString("F1", InvC)); - } - - if (cumulus.AWEKAS.SendSoilMoisture) - { - sb.Append("&soilmoisture1=" + SoilMoisture1); - sb.Append("&soilmoisture2=" + SoilMoisture2); - sb.Append("&soilmoisture3=" + SoilMoisture3); - sb.Append("&soilmoisture4=" + SoilMoisture4); - } - - if (cumulus.AWEKAS.SendLeafWetness) - { - sb.Append("&leafwetness1=" + LeafWetness1); - sb.Append("&leafwetness2=" + LeafWetness2); - sb.Append("&leafwetness3=" + LeafWetness3); - sb.Append("&leafwetness4=" + LeafWetness4); - } - - if (cumulus.AWEKAS.SendAirQuality) - { - switch (cumulus.StationOptions.PrimaryAqSensor) - { - case (int)Cumulus.PrimaryAqSensor.AirLinkOutdoor: - if (cumulus.airLinkDataOut != null) - { - sb.Append($"&AqPM1={cumulus.airLinkDataOut.pm1:F1}"); - sb.Append($"&AqPM2.5={cumulus.airLinkDataOut.pm2p5:F1}"); - sb.Append($"&AqPM10={cumulus.airLinkDataOut.pm10:F1}"); - sb.Append($"&AqPM2.5_avg_24h={cumulus.airLinkDataOut.pm2p5_24hr:F1}"); - sb.Append($"&AqPM10_avg_24h={cumulus.airLinkDataOut.pm10_24hr:F1}"); - } - break; - case (int)Cumulus.PrimaryAqSensor.Ecowitt1: - sb.Append($"&AqPM2.5={AirQuality1:F1}"); - sb.Append($"&AqPM2.5_avg_24h={AirQualityAvg1:F1}"); - break; - case (int)Cumulus.PrimaryAqSensor.Ecowitt2: - sb.Append($"&AqPM2.5={AirQuality2:F1}"); - sb.Append($"&AqPM2.5_avg_24h={AirQualityAvg2:F1}"); - break; - case (int)Cumulus.PrimaryAqSensor.Ecowitt3: - sb.Append($"&AqPM2.5={AirQuality3:F1}"); - sb.Append($"&AqPM2.5_avg_24h={AirQualityAvg3:F1}"); - break; - case (int)Cumulus.PrimaryAqSensor.Ecowitt4: - sb.Append($"&AqPM2.5={AirQuality4:F1}"); - sb.Append($"&AqPM2.5_avg_24h={AirQualityAvg4:F1}"); - break; - case (int)Cumulus.PrimaryAqSensor.EcowittCO2: - sb.Append($"&AqPM2.5={CO2_pm2p5:F1}"); - sb.Append($"&AqPM2.5_avg_24h={CO2_pm2p5_24h:F1}"); - sb.Append($"&AqPM10={CO2_pm10:F1}"); - sb.Append($"&AqPM10_avg_24h={CO2_pm10_24h:F1}"); - break; - } - } - - sb.Append("&output=json"); + // + // End of val fixed structure + // return sb.ToString(); } @@ -8755,6 +8768,8 @@ public string GetWundergroundURL(out string pwstring, DateTime timestamp, bool c { // API documentation: https://support.weather.com/s/article/PWS-Upload-Protocol?language=en_US + var invC = new CultureInfo(""); + string dateUTC = timestamp.ToUniversalTime().ToString("yyyy'-'MM'-'dd'+'HH'%3A'mm'%3A'ss"); StringBuilder URL = new StringBuilder(1024); if (cumulus.Wund.RapidFireEnabled && !catchup) @@ -8774,50 +8789,50 @@ public string GetWundergroundURL(out string pwstring, DateTime timestamp, bool c if (cumulus.Wund.SendAverage) { // send average speed and bearing - Data.Append($"&winddir={AvgBearing}&windspeedmph={WindMPHStr(WindAverage)}"); + Data.Append($"&winddir={AvgBearing}&windspeedmph={WindMPHStr(WindAverage).Replace(',', '.')}"); } else { // send "instantaneous" speed (i.e. latest) and bearing - Data.Append($"&winddir={Bearing}&windspeedmph={WindMPHStr(WindLatest)}"); + Data.Append($"&winddir={Bearing}&windspeedmph={WindMPHStr(WindLatest).Replace(',', '.')}"); } - Data.Append($"&windgustmph={WindMPHStr(RecentMaxGust)}"); + Data.Append($"&windgustmph={WindMPHStr(RecentMaxGust).Replace(',', '.')}"); // may not strictly be a 2 min average! - Data.Append($"&windspdmph_avg2m={WindMPHStr(WindAverage)}"); + Data.Append($"&windspdmph_avg2m={WindMPHStr(WindAverage).Replace(',', '.')}"); Data.Append($"&winddir_avg2m={AvgBearing}"); Data.Append($"&humidity={OutdoorHumidity}"); - Data.Append($"&tempf={TempFstr(OutdoorTemperature)}"); - Data.Append($"&rainin={RainINstr(RainLastHour)}"); + Data.Append($"&tempf={TempFstr(OutdoorTemperature).Replace(',', '.')}"); + Data.Append($"&rainin={RainINstr(RainLastHour).Replace(',', '.')}"); Data.Append("&dailyrainin="); if (cumulus.RolloverHour == 0) { // use today"s rain - Data.Append(RainINstr(RainToday)); + Data.Append(RainINstr(RainToday).Replace(',', '.')); } else { - Data.Append(RainINstr(RainSinceMidnight)); + Data.Append(RainINstr(RainSinceMidnight).Replace(',', '.')); } - Data.Append($"&baromin={PressINstr(Pressure)}"); - Data.Append($"&dewptf={TempFstr(OutdoorDewpoint)}"); + Data.Append($"&baromin={PressINstr(Pressure).Replace(',', '.')}"); + Data.Append($"&dewptf={TempFstr(OutdoorDewpoint).Replace(',', '.')}"); if (cumulus.Wund.SendUV) - Data.Append($"&UV={UV.ToString(cumulus.UVFormat)}"); + Data.Append($"&UV={UV.ToString(cumulus.UVFormat).Replace(',', '.')}"); if (cumulus.Wund.SendSolar) Data.Append($"&solarradiation={SolarRad:F0}"); if (cumulus.Wund.SendIndoor) { - Data.Append($"&indoortempf={TempFstr(IndoorTemperature)}"); + Data.Append($"&indoortempf={TempFstr(IndoorTemperature).Replace(',', '.')}"); Data.Append($"&indoorhumidity={IndoorHumidity}"); } // Davis soil and leaf sensors if (cumulus.Wund.SendSoilTemp1) - Data.Append($"&soiltempf={TempFstr(SoilTemp1)}"); + Data.Append($"&soiltempf={TempFstr(SoilTemp1).Replace(',', '.')}"); if (cumulus.Wund.SendSoilTemp2) - Data.Append($"&soiltempf2={TempFstr(SoilTemp2)}"); + Data.Append($"&soiltempf2={TempFstr(SoilTemp2).Replace(',', '.')}"); if (cumulus.Wund.SendSoilTemp3) - Data.Append($"&soiltempf3={TempFstr(SoilTemp3)}"); + Data.Append($"&soiltempf3={TempFstr(SoilTemp3).Replace(',', '.')}"); if (cumulus.Wund.SendSoilTemp4) - Data.Append($"&soiltempf4={TempFstr(SoilTemp4)}"); + Data.Append($"&soiltempf4={TempFstr(SoilTemp4).Replace(',', '.')}"); if (cumulus.Wund.SendSoilMoisture1) Data.Append($"&soilmoisture={SoilMoisture1}"); @@ -8840,20 +8855,20 @@ public string GetWundergroundURL(out string pwstring, DateTime timestamp, bool c case (int)Cumulus.PrimaryAqSensor.AirLinkOutdoor: if (cumulus.airLinkDataOut != null) { - Data.Append($"&AqPM2.5={cumulus.airLinkDataOut.pm2p5:F1}&AqPM10={cumulus.airLinkDataOut.pm10:F1}"); + Data.Append($"&AqPM2.5={cumulus.airLinkDataOut.pm2p5:F1}&AqPM10={cumulus.airLinkDataOut.pm10.ToString("F1", invC)}"); } break; case (int)Cumulus.PrimaryAqSensor.Ecowitt1: - Data.Append($"&AqPM2.5={AirQuality1:F1}"); + Data.Append($"&AqPM2.5={AirQuality1.ToString("F1", invC)}"); break; case (int)Cumulus.PrimaryAqSensor.Ecowitt2: - Data.Append($"&AqPM2.5={AirQuality2:F1}"); + Data.Append($"&AqPM2.5={AirQuality2.ToString("F1", invC)}"); break; case (int)Cumulus.PrimaryAqSensor.Ecowitt3: - Data.Append($"&AqPM2.5={AirQuality3:F1}"); + Data.Append($"&AqPM2.5={AirQuality3.ToString("F1", invC)}"); break; case (int)Cumulus.PrimaryAqSensor.Ecowitt4: - Data.Append($"&AqPM2.5={AirQuality4:F1}"); + Data.Append($"&AqPM2.5={AirQuality4.ToString("F1", invC)}"); break; } } @@ -8881,16 +8896,16 @@ public string GetWindyURL(out string apistring, DateTime timestamp) URL.Append("&dateutc=" + dateUTC); StringBuilder Data = new StringBuilder(1024); Data.Append("&winddir=" + AvgBearing); - Data.Append("&windspeedmph=" + WindMPHStr(WindAverage)); - Data.Append("&windgustmph=" + WindMPHStr(RecentMaxGust)); - Data.Append("&tempf=" + TempFstr(OutdoorTemperature)); - Data.Append("&rainin=" + RainINstr(RainLastHour)); - Data.Append("&baromin=" + PressINstr(Pressure)); - Data.Append("&dewptf=" + TempFstr(OutdoorDewpoint)); + Data.Append("&windspeedmph=" + WindMPHStr(WindAverage).Replace(',', '.')); + Data.Append("&windgustmph=" + WindMPHStr(RecentMaxGust).Replace(',', '.')); + Data.Append("&tempf=" + TempFstr(OutdoorTemperature).Replace(',', '.')); + Data.Append("&rainin=" + RainINstr(RainLastHour).Replace(',', '.')); + Data.Append("&baromin=" + PressINstr(Pressure).Replace(',', '.')); + Data.Append("&dewptf=" + TempFstr(OutdoorDewpoint).Replace(',', '.')); Data.Append("&humidity=" + OutdoorHumidity); if (cumulus.Windy.SendUV) - Data.Append("&uv=" + UV.ToString(cumulus.UVFormat)); + Data.Append("&uv=" + UV.ToString(cumulus.UVFormat).Replace(',', '.')); if (cumulus.Windy.SendSolar) Data.Append("&solarradiation=" + SolarRad.ToString("F0")); @@ -8903,16 +8918,17 @@ public string GetWindyURL(out string apistring, DateTime timestamp) public string GetOpenWeatherMapData(DateTime timestamp) { StringBuilder sb = new StringBuilder($"[{{\"station_id\":\"{cumulus.OpenWeatherMap.ID}\","); + var invC = new CultureInfo(""); sb.Append($"\"dt\":{Utils.ToUnixTime(timestamp)},"); - sb.Append($"\"temperature\":{Math.Round(ConvertUserTempToC(OutdoorTemperature), 1)},"); + sb.Append($"\"temperature\":{Math.Round(ConvertUserTempToC(OutdoorTemperature), 1).ToString(invC)},"); sb.Append($"\"wind_deg\":{AvgBearing},"); - sb.Append($"\"wind_speed\":{Math.Round(ConvertUserWindToMS(WindAverage), 1)},"); - sb.Append($"\"wind_gust\":{Math.Round(ConvertUserWindToMS(RecentMaxGust), 1)},"); - sb.Append($"\"pressure\":{Math.Round(PressureHPa(Pressure), 1)},"); + sb.Append($"\"wind_speed\":{Math.Round(ConvertUserWindToMS(WindAverage), 1).ToString(invC)},"); + sb.Append($"\"wind_gust\":{Math.Round(ConvertUserWindToMS(RecentMaxGust), 1).ToString(invC)},"); + sb.Append($"\"pressure\":{Math.Round(PressureHPa(Pressure), 1).ToString(invC)},"); sb.Append($"\"humidity\":{OutdoorHumidity},"); - sb.Append($"\"rain_1h\":{Math.Round(ConvertUserRainToMM(RainLastHour), 1)},"); - sb.Append($"\"rain_24h\":{Math.Round(ConvertUserRainToMM(RainLast24Hour), 1)}"); + sb.Append($"\"rain_1h\":{Math.Round(ConvertUserRainToMM(RainLastHour), 1).ToString(invC)},"); + sb.Append($"\"rain_24h\":{Math.Round(ConvertUserRainToMM(RainLast24Hour), 1).ToString(invC)}"); sb.Append("}]"); return sb.ToString(); @@ -8971,26 +8987,26 @@ public string GetPWSURL(out string pwstring, DateTime timestamp) // send average speed and bearing Data.Append("&winddir=" + AvgBearing); - Data.Append("&windspeedmph=" + WindMPHStr(WindAverage)); - Data.Append("&windgustmph=" + WindMPHStr(RecentMaxGust)); + Data.Append("&windspeedmph=" + WindMPHStr(WindAverage).Replace(',', '.')); + Data.Append("&windgustmph=" + WindMPHStr(RecentMaxGust).Replace(',', '.')); Data.Append("&humidity=" + OutdoorHumidity); - Data.Append("&tempf=" + TempFstr(OutdoorTemperature)); - Data.Append("&rainin=" + RainINstr(RainLastHour)); + Data.Append("&tempf=" + TempFstr(OutdoorTemperature).Replace(',', '.')); + Data.Append("&rainin=" + RainINstr(RainLastHour).Replace(',', '.')); Data.Append("&dailyrainin="); if (cumulus.RolloverHour == 0) { // use today"s rain - Data.Append(RainINstr(RainToday)); + Data.Append(RainINstr(RainToday).Replace(',', '.')); } else { - Data.Append(RainINstr(RainSinceMidnight)); + Data.Append(RainINstr(RainSinceMidnight).Replace(',', '.')); } - Data.Append("&baromin=" + PressINstr(Pressure)); - Data.Append("&dewptf=" + TempFstr(OutdoorDewpoint)); + Data.Append("&baromin=" + PressINstr(Pressure).Replace(',', '.')); + Data.Append("&dewptf=" + TempFstr(OutdoorDewpoint).Replace(',', '.')); if (cumulus.PWS.SendUV) { - Data.Append("&UV=" + UV.ToString(cumulus.UVFormat)); + Data.Append("&UV=" + UV.ToString(cumulus.UVFormat).Replace(',', '.')); } if (cumulus.PWS.SendSolar) @@ -9021,26 +9037,26 @@ public string GetWOWURL(out string pwstring, DateTime timestamp) // send average speed and bearing Data.Append("&winddir=" + AvgBearing); - Data.Append("&windspeedmph=" + WindMPHStr(WindAverage)); - Data.Append("&windgustmph=" + WindMPHStr(RecentMaxGust)); + Data.Append("&windspeedmph=" + WindMPHStr(WindAverage).Replace(',', '.')); + Data.Append("&windgustmph=" + WindMPHStr(RecentMaxGust).Replace(',', '.')); Data.Append("&humidity=" + OutdoorHumidity); - Data.Append("&tempf=" + TempFstr(OutdoorTemperature)); - Data.Append("&rainin=" + RainINstr(RainLastHour)); + Data.Append("&tempf=" + TempFstr(OutdoorTemperature).Replace(',', '.')); + Data.Append("&rainin=" + RainINstr(RainLastHour).Replace(',', '.')); Data.Append("&dailyrainin="); if (cumulus.RolloverHour == 0) { // use today"s rain - Data.Append(RainINstr(RainToday)); + Data.Append(RainINstr(RainToday).Replace(',', '.')); } else { - Data.Append(RainINstr(RainSinceMidnight)); + Data.Append(RainINstr(RainSinceMidnight).Replace(',', '.')); } - Data.Append("&baromin=" + PressINstr(Pressure)); - Data.Append("&dewptf=" + TempFstr(OutdoorDewpoint)); + Data.Append("&baromin=" + PressINstr(Pressure).Replace(',', '.')); + Data.Append("&dewptf=" + TempFstr(OutdoorDewpoint).Replace(',', '.')); if (cumulus.WOW.SendUV) { - Data.Append("&UV=" + UV.ToString(cumulus.UVFormat)); + Data.Append("&UV=" + UV.ToString(cumulus.UVFormat).Replace(',', '.')); } if (cumulus.WOW.SendSolar) { diff --git a/CumulusMX/webtags.cs b/CumulusMX/webtags.cs index c5e0e971..021baadc 100644 --- a/CumulusMX/webtags.cs +++ b/CumulusMX/webtags.cs @@ -5537,6 +5537,10 @@ public void InitialiseWebtags() { "LeafWetness2", TagLeafWetness2 }, { "LeafWetness3", TagLeafWetness3 }, { "LeafWetness4", TagLeafWetness4 }, + { "LeafWetness5", TagLeafWetness5 }, + { "LeafWetness6", TagLeafWetness6 }, + { "LeafWetness7", TagLeafWetness7 }, + { "LeafWetness8", TagLeafWetness8 }, { "LowTempAlarm", TagLowTempAlarm }, { "HighTempAlarm", TagHighTempAlarm }, { "TempChangeUpAlarm", TagTempChangeUpAlarm }, diff --git a/Updates.txt b/Updates.txt index 12dc65f4..ac601287 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,7 +1,10 @@ 3.10.5 - b3122 —————————————— +- Fix: Comma decimal issues with OpenWeatherMap and other third party uploads + - New: Now determines the Ecowitt GW1000 device main sensor type (WH65/WH24) and prints system information to the log file - New: Adds the free text station model to the Station settings page +- New: Adds a cache buster to default web site webpagedata.json downloads 3.10.4 - b3121 From aeeae3a79ce818912c5a65fcc51acd74bb54ce13 Mon Sep 17 00:00:00 2001 From: Mark Crossley <1196094+mcrossley@users.noreply.github.com> Date: Mon, 29 Mar 2021 12:26:05 +0100 Subject: [PATCH 4/6] Add dp=n and tc-y to all decimal web tags --- CumulusMX/WeatherStation.cs | 2 +- CumulusMX/webtags.cs | 739 +++++++++++++++++------------------- Updates.txt | 1 + 3 files changed, 344 insertions(+), 398 deletions(-) diff --git a/CumulusMX/WeatherStation.cs b/CumulusMX/WeatherStation.cs index 5c0283ef..05b5da75 100644 --- a/CumulusMX/WeatherStation.cs +++ b/CumulusMX/WeatherStation.cs @@ -10469,7 +10469,7 @@ public string GetSelectaChartOptions() } - public string GetDailyRainGraphData() + public string GetDailyRainGraphData() { var datefrom = DateTime.Now.AddDays(-cumulus.GraphDays - 1); diff --git a/CumulusMX/webtags.cs b/CumulusMX/webtags.cs index 021baadc..b472b62f 100644 --- a/CumulusMX/webtags.cs +++ b/CumulusMX/webtags.cs @@ -105,6 +105,30 @@ private static string CheckRc(string val, Dictionary tagParams) } } + private static string CheckRcDp(double val, Dictionary tagParams, int decimals) + { + string ret = ""; + try + { + if (tagParams.Get("tc") == "y") + return Math.Truncate(val).ToString(); + + int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : decimals; + + ret = val.ToString("F" + dp); + + if (tagParams.Get("rc") == "y") + { + ret = ReplaceCommas(ret); + } + return ret; + } + catch + { + return "error"; + } + } + private double GetSnowDepth(DateTime day) { double depth; @@ -312,14 +336,14 @@ private string GetFormattedDateTime(string dtstr, Dictionary TagP } */ - private string GetMonthlyAlltimeValueStr(AllTimeRec rec, string format) + private string GetMonthlyAlltimeValueStr(AllTimeRec rec, Dictionary tagParams, int decimals) { if (rec.Ts <= cumulus.defaultRecordTS) { return "---"; } - return rec.Val.ToString(format); + return CheckRcDp(rec.Val, tagParams, decimals); } /* @@ -338,17 +362,17 @@ private string GetMonthlyAlltimeTSStr(int identifier, int month, string format) private string Tagwlatest(Dictionary tagParams) { - return CheckRc(station.WindLatest.ToString(cumulus.WindFormat), tagParams); + return CheckRcDp(station.WindLatest, tagParams, cumulus.WindDPlaces); } private string Tagwindrun(Dictionary tagParams) { - return CheckRc(station.WindRunToday.ToString(cumulus.WindRunFormat), tagParams); + return CheckRcDp(station.WindRunToday, tagParams, cumulus.WindRunDPlaces); } private string Tagwspeed(Dictionary tagParams) { - return CheckRc(station.WindAverage.ToString(cumulus.WindAvgFormat), tagParams); + return CheckRcDp(station.WindAverage, tagParams, cumulus.WindAvgDPlaces); } private string Tagcurrentwdir(Dictionary tagParams) @@ -363,22 +387,22 @@ private string Tagwdir(Dictionary tagParams) private string Tagwgust(Dictionary tagParams) { - return CheckRc(station.RecentMaxGust.ToString(cumulus.WindFormat), tagParams); + return CheckRcDp(station.RecentMaxGust, tagParams, cumulus.WindDPlaces); } private string Tagwchill(Dictionary tagParams) { - return CheckRc(station.WindChill.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.WindChill, tagParams, cumulus.TempDPlaces); } private string Tagrrate(Dictionary tagParams) { - return CheckRc(station.RainRate.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.RainRate, tagParams, cumulus.RainDPlaces); } private string TagStormRain(Dictionary tagParams) { - return CheckRc(station.StormRain.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.StormRain, tagParams, cumulus.RainDPlaces); } private string TagStormRainStart(Dictionary tagParams) @@ -401,32 +425,32 @@ private string Tagtomorrowdaylength(Dictionary tagParams) private string TagwindrunY(Dictionary tagParams) { - return CheckRc(station.YesterdayWindRun.ToString(cumulus.WindRunFormat), tagParams); + return CheckRcDp(station.YesterdayWindRun, tagParams, cumulus.WindRunDPlaces); } private string Tagheatdegdays(Dictionary tagParams) { - return CheckRc(station.HeatingDegreeDays.ToString("F1"), tagParams); + return CheckRcDp(station.HeatingDegreeDays, tagParams, cumulus.TempDPlaces); } private string Tagcooldegdays(Dictionary tagParams) { - return CheckRc(station.CoolingDegreeDays.ToString("F1"), tagParams); + return CheckRcDp(station.CoolingDegreeDays, tagParams, cumulus.TempDPlaces); } private string TagheatdegdaysY(Dictionary tagParams) { - return CheckRc(station.YestHeatingDegreeDays.ToString("F1"), tagParams); + return CheckRcDp(station.YestHeatingDegreeDays, tagParams, cumulus.TempDPlaces); } private string TagcooldegdaysY(Dictionary tagParams) { - return CheckRc(station.YestCoolingDegreeDays.ToString("F1"), tagParams); + return CheckRcDp(station.YestCoolingDegreeDays, tagParams, cumulus.TempDPlaces); } private string Tagpresstrendval(Dictionary tagParams) { - return CheckRc(station.presstrendval.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.presstrendval, tagParams, cumulus.PressDPlaces); } private string TagTempChangeLastHour(Dictionary tagParams) @@ -436,12 +460,12 @@ private string TagTempChangeLastHour(Dictionary tagParams) private string Tagdew(Dictionary tagParams) { - return CheckRc(station.OutdoorDewpoint.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.OutdoorDewpoint, tagParams, cumulus.TempDPlaces); } private string Tagwetbulb(Dictionary tagParams) { - return CheckRc(station.WetBulb.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.WetBulb, tagParams, cumulus.TempDPlaces); } private string Tagcloudbase(Dictionary tagParams) @@ -624,42 +648,42 @@ private string Tagwsforecastenc(Dictionary tagParams) private string Tagtemp(Dictionary tagParams) { - return CheckRc(station.OutdoorTemperature.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.OutdoorTemperature, tagParams, cumulus.TempDPlaces); } private string Tagtemprange(Dictionary tagParams) { - return CheckRc(station.HiLoToday.TempRange.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.TempRange, tagParams, cumulus.TempDPlaces); } private string TagtemprangeY(Dictionary tagParams) { - return CheckRc(station.HiLoYest.TempRange.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.TempRange, tagParams, cumulus.TempDPlaces); } private string Tagavgtemp(Dictionary tagParams) { - return CheckRc((station.TempTotalToday/station.tempsamplestoday).ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.TempTotalToday/station.tempsamplestoday, tagParams, cumulus.TempDPlaces); } private string TagavgtempY(Dictionary tagParams) { - return CheckRc(station.YestAvgTemp.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.YestAvgTemp, tagParams, cumulus.TempDPlaces); } private string Tagapptemp(Dictionary tagParams) { - return CheckRc(station.ApparentTemperature.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ApparentTemperature, tagParams, cumulus.TempDPlaces); } private string Tagfeelsliketemp(Dictionary tagParams) { - return CheckRc(station.FeelsLike.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.FeelsLike, tagParams, cumulus.TempDPlaces); } private string Tagtemptrend(Dictionary tagParams) { - return CheckRc(station.temptrendval.ToString(cumulus.TempTrendFormat), tagParams); + return CheckRcDp(station.temptrendval, tagParams, cumulus.TempDPlaces); } private string Tagtemptrendtext(Dictionary tagParams) @@ -692,7 +716,7 @@ private string Tagtemptrendenglish(Dictionary tagParams) private string Tagheatindex(Dictionary tagParams) { - return CheckRc(station.HeatIndex.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HeatIndex, tagParams, cumulus.TempDPlaces); } private string Taghum(Dictionary tagParams) @@ -702,17 +726,17 @@ private string Taghum(Dictionary tagParams) private string Taghumidex(Dictionary tagParams) { - return CheckRc(station.Humidex.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.Humidex, tagParams, cumulus.TempDPlaces); } private string Tagpress(Dictionary tagParams) { - return CheckRc(station.Pressure.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.Pressure, tagParams, cumulus.PressDPlaces); } private string Tagaltimeterpressure(Dictionary tagParams) { - return CheckRc(station.AltimeterPressure.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.AltimeterPressure, tagParams, cumulus.TempDPlaces); } private string Tagpresstrend(Dictionary tagParams) @@ -847,32 +871,32 @@ private string TagWindRosePoints(Dictionary tagParams) private string Tagrfall(Dictionary tagParams) { - return CheckRc(station.RainToday.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.RainToday, tagParams, cumulus.RainDPlaces); } private string Tagrmidnight(Dictionary tagParams) { - return CheckRc(station.RainSinceMidnight.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.RainSinceMidnight, tagParams, cumulus.RainDPlaces); } private string Tagrmonth(Dictionary tagParams) { - return CheckRc(station.RainMonth.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.RainMonth, tagParams, cumulus.RainDPlaces); } private string Tagrhour(Dictionary tagParams) { - return CheckRc(station.RainLastHour.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.RainLastHour, tagParams, cumulus.RainDPlaces); } private string Tagr24Hour(Dictionary tagParams) { - return CheckRc(station.RainLast24Hour.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.RainLast24Hour, tagParams, cumulus.RainDPlaces); } private string Tagryear(Dictionary tagParams) { - return CheckRc(station.RainYear.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.RainYear, tagParams, cumulus.RainDPlaces); } private string Taginhum(Dictionary tagParams) @@ -882,7 +906,7 @@ private string Taginhum(Dictionary tagParams) private string Tagintemp(Dictionary tagParams) { - return CheckRc(station.IndoorTemperature.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.IndoorTemperature, tagParams, cumulus.TempDPlaces); } private string Tagbattery(Dictionary tagParams) @@ -948,55 +972,55 @@ private string TagMulticastGoodPct(Dictionary tagParams) // AirLink Indoor private string TagAirLinkTempIn(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.temperature.ToString(cumulus.TempFormat), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.temperature, tagParams, cumulus.TempDPlaces); } private string TagAirLinkHumIn(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.humidity.ToString(cumulus.HumFormat), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.humidity, tagParams, cumulus.HumDPlaces); } private string TagAirLinkPm1In(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm1.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm1, tagParams, 1); } private string TagAirLinkPm2p5In(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm2p5.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm2p5, tagParams, 1); } private string TagAirLinkPm2p5_1hrIn(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm2p5_1hr.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm2p5_1hr, tagParams, 1); } private string TagAirLinkPm2p5_3hrIn(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm2p5_3hr.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm2p5_3hr, tagParams, 1); } private string TagAirLinkPm2p5_24hrIn(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm2p5_24hr.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm2p5_24hr, tagParams, 1); } private string TagAirLinkPm2p5_NowcastIn(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm2p5_nowcast.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm2p5_nowcast, tagParams, 1); } private string TagAirLinkPm10In(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm10.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm10, tagParams, 1); } private string TagAirLinkPm10_1hrIn(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm10_1hr.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm10_1hr, tagParams, 1); } private string TagAirLinkPm10_3hrIn(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm10_3hr.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm10_3hr, tagParams, 1); } private string TagAirLinkPm10_24hrIn(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm10_24hr.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm10_24hr, tagParams, 1); } private string TagAirLinkPm10_NowcastIn(Dictionary tagParams) { - return cumulus.airLinkDataIn == null ? "--" : CheckRc(cumulus.airLinkDataIn.pm10_nowcast.ToString("F1"), tagParams); + return cumulus.airLinkDataIn == null ? "--" : CheckRcDp(cumulus.airLinkDataIn.pm10_nowcast, tagParams, 1); } private string TagAirLinkFirmwareVersionIn(Dictionary tagParams) { @@ -1011,55 +1035,55 @@ private string TagAirLinkWifiRssiIn(Dictionary tagParams) // AirLink Outdoor private string TagAirLinkTempOut(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.temperature.ToString(cumulus.TempFormat), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.temperature, tagParams, cumulus.TempDPlaces); } private string TagAirLinkHumOut(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.humidity.ToString(cumulus.HumFormat), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.humidity, tagParams, cumulus.HumDPlaces); } private string TagAirLinkPm1Out(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm1.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm1, tagParams, 1); } private string TagAirLinkPm2p5Out(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm2p5.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm2p5, tagParams, 1); } private string TagAirLinkPm2p5_1hrOut(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm2p5_1hr.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm2p5_1hr, tagParams, 1); } private string TagAirLinkPm2p5_3hrOut(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm2p5_3hr.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm2p5_3hr, tagParams, 1); } private string TagAirLinkPm2p5_24hrOut(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm2p5_24hr.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm2p5_24hr, tagParams, 1); } private string TagAirLinkPm2p5_NowcastOut(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm2p5_nowcast.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm2p5_nowcast, tagParams, 1); } private string TagAirLinkPm10Out(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm10.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm10, tagParams, 1); } private string TagAirLinkPm10_1hrOut(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm10_1hr.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm10_1hr, tagParams, 1); } private string TagAirLinkPm10_3hrOut(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm10_3hr.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm10_3hr, tagParams, 1); } private string TagAirLinkPm10_24hrOut(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm10_24hr.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm10_24hr, tagParams, 1); } private string TagAirLinkPm10_NowcastOut(Dictionary tagParams) { - return cumulus.airLinkDataOut == null ? "--" : CheckRc(cumulus.airLinkDataOut.pm10_nowcast.ToString("F1"), tagParams); + return cumulus.airLinkDataOut == null ? "--" : CheckRcDp(cumulus.airLinkDataOut.pm10_nowcast, tagParams, 1); } private string TagAirLinkFirmwareVersionOut(Dictionary tagParams) { @@ -1074,203 +1098,143 @@ private string TagAirLinkAqiPm2P5In(Dictionary tagParams) { if (cumulus.airLinkDataIn == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataIn.aqiPm2p5).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataIn.aqiPm2p5.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataIn.aqiPm2p5, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm2p5_1hrIn(Dictionary tagParams) { if (cumulus.airLinkDataIn == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataIn.aqiPm2p5_1hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataIn.aqiPm2p5_1hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataIn.aqiPm2p5_1hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm2p5_3hrIn(Dictionary tagParams) { if (cumulus.airLinkDataIn == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataIn.aqiPm2p5_3hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataIn.aqiPm2p5_3hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataIn.aqiPm2p5_3hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm2p5_24hrIn(Dictionary tagParams) { if (cumulus.airLinkDataIn == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataIn.aqiPm2p5_24hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataIn.aqiPm2p5_24hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataIn.aqiPm2p5_24hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm2p5_NowcastIn(Dictionary tagParams) { if (cumulus.airLinkDataIn == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataIn.aqiPm2p5_nowcast).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataIn.aqiPm2p5_nowcast.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataIn.aqiPm2p5_nowcast, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm10In(Dictionary tagParams) { if (cumulus.airLinkDataIn == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataIn.aqiPm10).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataIn.aqiPm10.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataIn.aqiPm10, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm10_1hrIn(Dictionary tagParams) { if (cumulus.airLinkDataIn == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataIn.aqiPm10_1hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataIn.aqiPm10_1hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataIn.aqiPm10_1hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm10_3hrIn(Dictionary tagParams) { if (cumulus.airLinkDataIn == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataIn.aqiPm10_3hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataIn.aqiPm10_3hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataIn.aqiPm10_3hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm10_24hrIn(Dictionary tagParams) { if (cumulus.airLinkDataIn == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataIn.aqiPm10_24hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataIn.aqiPm10_24hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataIn.aqiPm10_24hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm10_NowcastIn(Dictionary tagParams) { if (cumulus.airLinkDataIn == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataIn.aqiPm10_nowcast).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataIn.aqiPm10_nowcast.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataIn.aqiPm10_nowcast, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm2P5Out(Dictionary tagParams) { if (cumulus.airLinkDataOut == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataOut.aqiPm2p5).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataOut.aqiPm2p5.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataOut.aqiPm2p5, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm2p5_1hrOut(Dictionary tagParams) { if (cumulus.airLinkDataOut == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataOut.aqiPm2p5_1hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataOut.aqiPm2p5_1hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataOut.aqiPm2p5_1hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm2p5_3hrOut(Dictionary tagParams) { if (cumulus.airLinkDataOut == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataOut.aqiPm2p5_3hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataOut.aqiPm2p5_3hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataOut.aqiPm2p5_3hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm2p5_24hrOut(Dictionary tagParams) { if (cumulus.airLinkDataOut == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataOut.aqiPm2p5_24hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataOut.aqiPm2p5_24hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataOut.aqiPm2p5_24hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm2p5_NowcastOut(Dictionary tagParams) { if (cumulus.airLinkDataOut == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataOut.aqiPm2p5_nowcast).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataOut.aqiPm2p5_nowcast.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataOut.aqiPm2p5_nowcast, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm10Out(Dictionary tagParams) { if (cumulus.airLinkDataOut == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataOut.aqiPm10).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataOut.aqiPm10.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataOut.aqiPm10, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm10_1hrOut(Dictionary tagParams) { if (cumulus.airLinkDataOut == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataOut.aqiPm10_1hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataOut.aqiPm10_1hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataOut.aqiPm10_1hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm10_3hrOut(Dictionary tagParams) { if (cumulus.airLinkDataOut == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataOut.aqiPm10_3hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataOut.aqiPm10_3hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataOut.aqiPm10_3hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm10_24hrOut(Dictionary tagParams) { if (cumulus.airLinkDataOut == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataOut.aqiPm10_24hr).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataOut.aqiPm10_24hr.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataOut.aqiPm10_24hr, tagParams, cumulus.AirQualityDPlaces); } private string TagAirLinkAqiPm10_NowcastOut(Dictionary tagParams) { if (cumulus.airLinkDataOut == null) return "--"; - if (tagParams.Get("tc") == "y") - return Math.Truncate(cumulus.airLinkDataOut.aqiPm10_nowcast).ToString(); - int dp = int.TryParse(tagParams.Get("dp"), out dp) ? dp : cumulus.AirQualityDPlaces; - return CheckRc(cumulus.airLinkDataOut.aqiPm10_nowcast.ToString("F" + dp), tagParams); + return CheckRcDp(cumulus.airLinkDataOut.aqiPm10_nowcast, tagParams, cumulus.AirQualityDPlaces); } @@ -1552,7 +1516,7 @@ private string Tagerrorlight(Dictionary tagParams) private string TagtempTh(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighTemp.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighTemp, tagParams, cumulus.TempDPlaces); } private string TagTtempTh(Dictionary tagParams) @@ -1562,7 +1526,7 @@ private string TagTtempTh(Dictionary tagParams) private string TagtempTl(Dictionary tagParams) { - return CheckRc(station.HiLoToday.LowTemp.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.LowTemp, tagParams, cumulus.TempDPlaces); } private string TagTtempTl(Dictionary tagParams) @@ -1582,7 +1546,7 @@ private string TagTsolarTh(Dictionary tagParams) private string TagUvth(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighUv.ToString(cumulus.UVFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighUv, tagParams, cumulus.UVDPlaces); } private string TagTuvth(Dictionary tagParams) @@ -1592,7 +1556,7 @@ private string TagTuvth(Dictionary tagParams) private string TagapptempTh(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighAppTemp.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighAppTemp, tagParams, cumulus.TempDPlaces); } private string TagRCapptempTh(Dictionary tagParams) @@ -1607,7 +1571,7 @@ private string TagTapptempTh(Dictionary tagParams) private string TagapptempTl(Dictionary tagParams) { - return CheckRc(station.HiLoToday.LowAppTemp.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.LowAppTemp, tagParams, cumulus.TempDPlaces); } private string TagRCapptempTl(Dictionary tagParams) @@ -1622,7 +1586,7 @@ private string TagTapptempTl(Dictionary tagParams) private string TagfeelslikeTh(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighFeelsLike.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighFeelsLike, tagParams, cumulus.TempDPlaces); } private string TagTfeelslikeTh(Dictionary tagParams) @@ -1632,7 +1596,7 @@ private string TagTfeelslikeTh(Dictionary tagParams) private string TagfeelslikeTl(Dictionary tagParams) { - return CheckRc(station.HiLoToday.LowFeelsLike.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.LowFeelsLike, tagParams, cumulus.TempDPlaces); } private string TagTfeelslikeTl(Dictionary tagParams) @@ -1642,7 +1606,7 @@ private string TagTfeelslikeTl(Dictionary tagParams) private string TaghumidexTh(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighHumidex.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighHumidex, tagParams, cumulus.TempDPlaces); } private string TagThumidexTh(Dictionary tagParams) @@ -1652,7 +1616,7 @@ private string TagThumidexTh(Dictionary tagParams) private string TagdewpointTh(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighDewPoint.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighDewPoint, tagParams, cumulus.TempDPlaces); } private string TagRCdewpointTh(Dictionary tagParams) @@ -1667,7 +1631,7 @@ private string TagTdewpointTh(Dictionary tagParams) private string TagdewpointTl(Dictionary tagParams) { - return CheckRc(station.HiLoToday.LowDewPoint.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.LowDewPoint, tagParams, cumulus.TempDPlaces); } private string TagRCdewpointTl(Dictionary tagParams) @@ -1682,7 +1646,7 @@ private string TagTdewpointTl(Dictionary tagParams) private string TagwchillTl(Dictionary tagParams) { - return CheckRc(station.HiLoToday.LowWindChill.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.LowWindChill, tagParams, cumulus.TempDPlaces); } private string TagRCwchillTl(Dictionary tagParams) @@ -1697,7 +1661,7 @@ private string TagTwchillTl(Dictionary tagParams) private string TagheatindexTh(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighHeatIndex.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighHeatIndex, tagParams, cumulus.TempDPlaces); } private string TagRCheatindexTh(Dictionary tagParams) @@ -1712,7 +1676,7 @@ private string TagTheatindexTh(Dictionary tagParams) private string TagheatindexYh(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighHeatIndex.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighHeatIndex, tagParams, cumulus.TempDPlaces); } private string TagTheatindexYh(Dictionary tagParams) @@ -1722,7 +1686,7 @@ private string TagTheatindexYh(Dictionary tagParams) private string TagpressTh(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighPress.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighPress, tagParams, cumulus.PressDPlaces); } private string TagTpressTh(Dictionary tagParams) @@ -1732,7 +1696,7 @@ private string TagTpressTh(Dictionary tagParams) private string TagpressTl(Dictionary tagParams) { - return CheckRc(station.HiLoToday.LowPress.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.HiLoToday.LowPress, tagParams, cumulus.PressDPlaces); } private string TagTpressTl(Dictionary tagParams) @@ -1762,7 +1726,7 @@ private string TagThumTl(Dictionary tagParams) private string TagwindTm(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighWind.ToString(cumulus.WindAvgFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighWind, tagParams, cumulus.WindAvgDPlaces); } private string TagTbeaufort(Dictionary tagParams) @@ -1787,7 +1751,7 @@ private string TagTwindTm(Dictionary tagParams) private string TagwgustTm(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighGust.ToString(cumulus.WindFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighGust, tagParams, cumulus.WindDPlaces); } private string TagTwgustTm(Dictionary tagParams) @@ -1807,7 +1771,7 @@ private string TagdirectionTm(Dictionary tagParams) private string TagrrateTm(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighRainRate.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighRainRate, tagParams, cumulus.RainDPlaces); } private string TagTrrateTm(Dictionary tagParams) @@ -1817,7 +1781,7 @@ private string TagTrrateTm(Dictionary tagParams) private string TaghourlyrainTh(Dictionary tagParams) { - return CheckRc(station.HiLoToday.HighHourlyRain.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.HiLoToday.HighHourlyRain, tagParams, cumulus.RainDPlaces); } private string TagThourlyrainTh(Dictionary tagParams) @@ -1827,7 +1791,7 @@ private string TagThourlyrainTh(Dictionary tagParams) private string TaghourlyrainYh(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighHourlyRain.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighHourlyRain, tagParams, cumulus.RainDPlaces); } private string TagThourlyrainYh(Dictionary tagParams) @@ -1847,7 +1811,7 @@ private string TagTsolarYh(Dictionary tagParams) private string TagUvyh(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighUv.ToString(cumulus.UVFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighUv, tagParams, cumulus.UVDPlaces); } private string TagTuvyh(Dictionary tagParams) @@ -1872,12 +1836,12 @@ private string Tagrollovertime(Dictionary tagParams) private string TagRg11RainToday(Dictionary tagParams) { - return CheckRc(station.RG11RainToday.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.RG11RainToday, tagParams, cumulus.RainDPlaces); } private string TagRg11RainYest(Dictionary tagParams) { - return CheckRc(station.RG11RainYesterday.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.RG11RainYesterday, tagParams, cumulus.RainDPlaces); } private string Tagcurrcond(Dictionary tagParams) @@ -1892,7 +1856,7 @@ private string Tagcurrcondenc(Dictionary tagParams) private string TagtempYh(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighTemp.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighTemp, tagParams, cumulus.TempDPlaces); } private string TagTtempYh(Dictionary tagParams) @@ -1902,7 +1866,7 @@ private string TagTtempYh(Dictionary tagParams) private string TagtempYl(Dictionary tagParams) { - return CheckRc(station.HiLoYest.LowTemp.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.LowTemp, tagParams, cumulus.TempDPlaces); } private string TagTtempYl(Dictionary tagParams) @@ -1912,7 +1876,7 @@ private string TagTtempYl(Dictionary tagParams) private string TagapptempYh(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighAppTemp.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighAppTemp, tagParams, cumulus.TempDPlaces); } private string TagTapptempYh(Dictionary tagParams) @@ -1922,7 +1886,7 @@ private string TagTapptempYh(Dictionary tagParams) private string TagapptempYl(Dictionary tagParams) { - return CheckRc(station.HiLoYest.LowAppTemp.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.LowAppTemp, tagParams, cumulus.TempDPlaces); } private string TagTapptempYl(Dictionary tagParams) @@ -1932,12 +1896,12 @@ private string TagTapptempYl(Dictionary tagParams) private string TagdewpointYh(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighDewPoint.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighDewPoint, tagParams, cumulus.TempDPlaces); } private string TagfeelslikeYh(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighFeelsLike.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighFeelsLike, tagParams, cumulus.TempDPlaces); } private string TagTfeelslikeYh(Dictionary tagParams) @@ -1947,7 +1911,7 @@ private string TagTfeelslikeYh(Dictionary tagParams) private string TagfeelslikeYl(Dictionary tagParams) { - return CheckRc(station.HiLoYest.LowFeelsLike.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.LowFeelsLike, tagParams, cumulus.TempDPlaces); } private string TagTfeelslikeYl(Dictionary tagParams) @@ -1957,7 +1921,7 @@ private string TagTfeelslikeYl(Dictionary tagParams) private string TaghumidexYh(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighHumidex.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighHumidex, tagParams, cumulus.TempDPlaces); } private string TagThumidexYh(Dictionary tagParams) @@ -1972,7 +1936,7 @@ private string TagTdewpointYh(Dictionary tagParams) private string TagdewpointYl(Dictionary tagParams) { - return CheckRc(station.HiLoYest.LowDewPoint.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.LowDewPoint, tagParams, cumulus.TempDPlaces); } private string TagTdewpointYl(Dictionary tagParams) @@ -1982,7 +1946,7 @@ private string TagTdewpointYl(Dictionary tagParams) private string TagwchillYl(Dictionary tagParams) { - return CheckRc(station.HiLoYest.LowWindChill.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.HiLoYest.LowWindChill, tagParams, cumulus.TempDPlaces); } private string TagTwchillYl(Dictionary tagParams) @@ -1992,7 +1956,7 @@ private string TagTwchillYl(Dictionary tagParams) private string TagpressYh(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighPress.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighPress, tagParams, cumulus.PressDPlaces); } private string TagTpressYh(Dictionary tagParams) @@ -2002,7 +1966,7 @@ private string TagTpressYh(Dictionary tagParams) private string TagpressYl(Dictionary tagParams) { - return CheckRc(station.HiLoYest.LowPress.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.HiLoYest.LowPress, tagParams, cumulus.PressDPlaces); } private string TagTpressYl(Dictionary tagParams) @@ -2032,7 +1996,7 @@ private string TagThumYl(Dictionary tagParams) private string TagwindYm(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighWind.ToString(cumulus.WindAvgFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighWind, tagParams, cumulus.WindAvgDPlaces); } private string TagYbeaufort(Dictionary tagParams) @@ -2057,7 +2021,7 @@ private string TagTwindYm(Dictionary tagParams) private string TagwgustYm(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighGust.ToString(cumulus.WindFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighGust, tagParams, cumulus.WindDPlaces); } private string TagTwgustYm(Dictionary tagParams) @@ -2077,7 +2041,7 @@ private string TagdirectionYm(Dictionary tagParams) private string TagrrateYm(Dictionary tagParams) { - return CheckRc(station.HiLoYest.HighRainRate.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.HiLoYest.HighRainRate, tagParams, cumulus.RainDPlaces); } private string TagTrrateYm(Dictionary tagParams) @@ -2087,13 +2051,13 @@ private string TagTrrateYm(Dictionary tagParams) private string TagrfallY(Dictionary tagParams) { - return CheckRc(station.RainYesterday.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.RainYesterday, tagParams, cumulus.RainDPlaces); } // all time records private string TagtempH(Dictionary tagParams) { - return CheckRc(station.AllTime.HighTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.HighTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagTtempH(Dictionary tagParams) @@ -2103,7 +2067,7 @@ private string TagTtempH(Dictionary tagParams) private string TagtempL(Dictionary tagParams) { - return CheckRc(station.AllTime.LowTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.LowTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagTtempL(Dictionary tagParams) @@ -2113,7 +2077,7 @@ private string TagTtempL(Dictionary tagParams) private string TagapptempH(Dictionary tagParams) { - return CheckRc(station.AllTime.HighAppTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.HighAppTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagTapptempH(Dictionary tagParams) @@ -2123,7 +2087,7 @@ private string TagTapptempH(Dictionary tagParams) private string TagapptempL(Dictionary tagParams) { - return CheckRc(station.AllTime.LowAppTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.LowAppTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagTapptempL(Dictionary tagParams) @@ -2133,7 +2097,7 @@ private string TagTapptempL(Dictionary tagParams) private string TagfeelslikeH(Dictionary tagParams) { - return CheckRc(station.AllTime.HighFeelsLike.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.HighFeelsLike.Val, tagParams, cumulus.TempDPlaces); } private string TagTfeelslikeH(Dictionary tagParams) @@ -2143,7 +2107,7 @@ private string TagTfeelslikeH(Dictionary tagParams) private string TagfeelslikeL(Dictionary tagParams) { - return CheckRc(station.AllTime.LowFeelsLike.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.LowFeelsLike.Val, tagParams, cumulus.TempDPlaces); } private string TagTfeelslikeL(Dictionary tagParams) @@ -2153,7 +2117,7 @@ private string TagTfeelslikeL(Dictionary tagParams) private string TaghumidexH(Dictionary tagParams) { - return CheckRc(station.AllTime.HighHumidex.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.HighHumidex.Val, tagParams, cumulus.TempDPlaces); } private string TagThumidexH(Dictionary tagParams) @@ -2163,7 +2127,7 @@ private string TagThumidexH(Dictionary tagParams) private string TagdewpointH(Dictionary tagParams) { - return CheckRc(station.AllTime.HighDewPoint.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.HighDewPoint.Val, tagParams, cumulus.TempDPlaces); } private string TagTdewpointH(Dictionary tagParams) @@ -2173,7 +2137,7 @@ private string TagTdewpointH(Dictionary tagParams) private string TagdewpointL(Dictionary tagParams) { - return CheckRc(station.AllTime.LowDewPoint.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.LowDewPoint.Val, tagParams, cumulus.TempDPlaces); } private string TagTdewpointL(Dictionary tagParams) @@ -2183,7 +2147,7 @@ private string TagTdewpointL(Dictionary tagParams) private string TagheatindexH(Dictionary tagParams) { - return CheckRc(station.AllTime.HighHeatIndex.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.HighHeatIndex.Val, tagParams, cumulus.TempDPlaces); } private string TagTheatindexH(Dictionary tagParams) @@ -2193,7 +2157,7 @@ private string TagTheatindexH(Dictionary tagParams) private string TaggustM(Dictionary tagParams) { - return CheckRc(station.AllTime.HighGust.Val.ToString(cumulus.WindFormat), tagParams); + return CheckRcDp(station.AllTime.HighGust.Val, tagParams, cumulus.WindDPlaces); } private string TagTgustM(Dictionary tagParams) @@ -2203,7 +2167,7 @@ private string TagTgustM(Dictionary tagParams) private string TagwspeedH(Dictionary tagParams) { - return CheckRc(station.AllTime.HighWind.Val.ToString(cumulus.WindAvgFormat), tagParams); + return CheckRcDp(station.AllTime.HighWind.Val, tagParams, cumulus.WindAvgDPlaces); } private string TagTwspeedH(Dictionary tagParams) @@ -2213,7 +2177,7 @@ private string TagTwspeedH(Dictionary tagParams) private string TagwchillH(Dictionary tagParams) { - return CheckRc(station.AllTime.LowChill.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.LowChill.Val, tagParams, cumulus.TempDPlaces); } private string TagTwchillH(Dictionary tagParams) @@ -2223,7 +2187,7 @@ private string TagTwchillH(Dictionary tagParams) private string TagrrateM(Dictionary tagParams) { - return CheckRc(station.AllTime.HighRainRate.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.AllTime.HighRainRate.Val, tagParams, cumulus.RainDPlaces); } private string TagTrrateM(Dictionary tagParams) @@ -2233,7 +2197,7 @@ private string TagTrrateM(Dictionary tagParams) private string TagwindrunH(Dictionary tagParams) { - return CheckRc(station.AllTime.HighWindRun.Val.ToString(cumulus.WindRunFormat), tagParams); + return CheckRcDp(station.AllTime.HighWindRun.Val, tagParams, cumulus.WindRunDPlaces); } private string TagTwindrunH(Dictionary tagParams) @@ -2243,7 +2207,7 @@ private string TagTwindrunH(Dictionary tagParams) private string TagrfallH(Dictionary tagParams) { - return CheckRc(station.AllTime.DailyRain.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.AllTime.DailyRain.Val, tagParams, cumulus.RainDPlaces); } private string TagTrfallH(Dictionary tagParams) @@ -2273,12 +2237,12 @@ private string TagTLongestWetPeriod(Dictionary tagParams) private string TagLowDailyTempRange(Dictionary tagParams) { - return CheckRc(station.AllTime.LowDailyTempRange.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.LowDailyTempRange.Val, tagParams, cumulus.TempDPlaces); } private string TagHighDailyTempRange(Dictionary tagParams) { - return CheckRc(station.AllTime.HighDailyTempRange.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.HighDailyTempRange.Val, tagParams, cumulus.TempDPlaces); } private string TagTLowDailyTempRange(Dictionary tagParams) @@ -2293,7 +2257,7 @@ private string TagTHighDailyTempRange(Dictionary tagParams) private string TagrfallhH(Dictionary tagParams) { - return CheckRc(station.AllTime.HourlyRain.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.AllTime.HourlyRain.Val, tagParams, cumulus.RainDPlaces); } private string TagTrfallhH(Dictionary tagParams) @@ -2303,7 +2267,7 @@ private string TagTrfallhH(Dictionary tagParams) private string TagrfallmH(Dictionary tagParams) { - return CheckRc(station.AllTime.MonthlyRain.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.AllTime.MonthlyRain.Val, tagParams, cumulus.RainDPlaces); } private string TagTrfallmH(Dictionary tagParams) @@ -2313,7 +2277,7 @@ private string TagTrfallmH(Dictionary tagParams) private string TagpressH(Dictionary tagParams) { - return CheckRc(station.AllTime.HighPress.Val.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.AllTime.HighPress.Val, tagParams, cumulus.PressDPlaces); } private string TagTpressH(Dictionary tagParams) @@ -2323,7 +2287,7 @@ private string TagTpressH(Dictionary tagParams) private string TagpressL(Dictionary tagParams) { - return CheckRc(station.AllTime.LowPress.Val.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.AllTime.LowPress.Val, tagParams, cumulus.PressDPlaces); } private string TagTpressL(Dictionary tagParams) @@ -2365,7 +2329,7 @@ private string TagDaysSinceRecordsBegan(Dictionary tagParams) private string TagmintempH(Dictionary tagParams) { - return CheckRc(station.AllTime.HighMinTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.HighMinTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagTmintempH(Dictionary tagParams) @@ -2375,7 +2339,7 @@ private string TagTmintempH(Dictionary tagParams) private string TagmaxtempL(Dictionary tagParams) { - return CheckRc(station.AllTime.LowMaxTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.AllTime.LowMaxTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagTmaxtempL(Dictionary tagParams) @@ -2388,7 +2352,7 @@ private string TagTmaxtempL(Dictionary tagParams) private string TagByMonthTempH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighTemp, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighTemp, tagParams, cumulus.TempDPlaces); } private string TagByMonthTempHt(Dictionary tagParams) @@ -2400,7 +2364,7 @@ private string TagByMonthTempHt(Dictionary tagParams) private string TagByMonthTempL(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowTemp, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowTemp, tagParams, cumulus.TempDPlaces); } private string TagByMonthTempLt(Dictionary tagParams) @@ -2412,7 +2376,7 @@ private string TagByMonthTempLt(Dictionary tagParams) private string TagByMonthAppTempH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighAppTemp, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighAppTemp, tagParams, cumulus.TempDPlaces); } private string TagByMonthAppTempHt(Dictionary tagParams) @@ -2424,7 +2388,7 @@ private string TagByMonthAppTempHt(Dictionary tagParams) private string TagByMonthAppTempL(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowAppTemp, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowAppTemp, tagParams, cumulus.TempDPlaces); } private string TagByMonthAppTempLt(Dictionary tagParams) @@ -2436,7 +2400,7 @@ private string TagByMonthAppTempLt(Dictionary tagParams) private string TagByMonthFeelsLikeH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighFeelsLike, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighFeelsLike, tagParams, cumulus.TempDPlaces); } private string TagByMonthFeelsLikeHt(Dictionary tagParams) @@ -2448,7 +2412,7 @@ private string TagByMonthFeelsLikeHt(Dictionary tagParams) private string TagByMonthFeelsLikeL(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowFeelsLike, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowFeelsLike, tagParams, cumulus.TempDPlaces); } private string TagByMonthFeelsLikeLt(Dictionary tagParams) @@ -2460,7 +2424,7 @@ private string TagByMonthFeelsLikeLt(Dictionary tagParams) private string TagByMonthHumidexH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighHumidex, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighHumidex, tagParams, cumulus.TempDPlaces); } private string TagByMonthHumidexHt(Dictionary tagParams) @@ -2472,7 +2436,7 @@ private string TagByMonthHumidexHt(Dictionary tagParams) private string TagByMonthDewPointH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighDewPoint, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighDewPoint, tagParams, cumulus.TempDPlaces); } private string TagByMonthDewPointHt(Dictionary tagParams) @@ -2484,7 +2448,7 @@ private string TagByMonthDewPointHt(Dictionary tagParams) private string TagByMonthDewPointL(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowDewPoint, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowDewPoint, tagParams, cumulus.TempDPlaces); } private string TagByMonthDewPointLt(Dictionary tagParams) @@ -2496,7 +2460,7 @@ private string TagByMonthDewPointLt(Dictionary tagParams) private string TagByMonthHeatIndexH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighHeatIndex, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighHeatIndex, tagParams, cumulus.TempDPlaces); } private string TagByMonthHeatIndexHt(Dictionary tagParams) @@ -2508,7 +2472,7 @@ private string TagByMonthHeatIndexHt(Dictionary tagParams) private string TagByMonthGustH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighGust, cumulus.WindFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighGust, tagParams, cumulus.WindDPlaces); } private string TagByMonthGustHt(Dictionary tagParams) @@ -2520,7 +2484,7 @@ private string TagByMonthGustHt(Dictionary tagParams) private string TagByMonthWindH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighWind, cumulus.WindAvgFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighWind, tagParams, cumulus.WindAvgDPlaces); } private string TagByMonthWindHt(Dictionary tagParams) @@ -2532,7 +2496,7 @@ private string TagByMonthWindHt(Dictionary tagParams) private string TagByMonthWChillL(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowChill, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowChill, tagParams, cumulus.TempDPlaces); } private string TagByMonthWChillLt(Dictionary tagParams) @@ -2544,7 +2508,7 @@ private string TagByMonthWChillLt(Dictionary tagParams) private string TagByMonthRainRateH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighRainRate, cumulus.RainFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighRainRate, tagParams, cumulus.RainDPlaces); } private string TagByMonthRainRateHt(Dictionary tagParams) @@ -2556,7 +2520,7 @@ private string TagByMonthRainRateHt(Dictionary tagParams) private string TagByMonthWindRunH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighWindRun, cumulus.WindRunFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighWindRun, tagParams, cumulus.WindRunDPlaces); } private string TagByMonthWindRunHt(Dictionary tagParams) @@ -2568,7 +2532,7 @@ private string TagByMonthWindRunHt(Dictionary tagParams) private string TagByMonthDailyRainH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].DailyRain, cumulus.RainFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].DailyRain, tagParams, cumulus.RainDPlaces); } private string TagByMonthDailyRainHt(Dictionary tagParams) @@ -2580,7 +2544,7 @@ private string TagByMonthDailyRainHt(Dictionary tagParams) private string TagByMonthLongestDryPeriod(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LongestDryPeriod, "F0"); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LongestDryPeriod, tagParams, 0); } private string TagByMonthLongestDryPeriodT(Dictionary tagParams) @@ -2592,7 +2556,7 @@ private string TagByMonthLongestDryPeriodT(Dictionary tagParams) private string TagByMonthLongestWetPeriod(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LongestWetPeriod, "F0"); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LongestWetPeriod, tagParams, 0); } private string TagByMonthLongestWetPeriodT(Dictionary tagParams) @@ -2604,13 +2568,13 @@ private string TagByMonthLongestWetPeriodT(Dictionary tagParams) private string TagByMonthLowDailyTempRange(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowDailyTempRange, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowDailyTempRange, tagParams, cumulus.TempDPlaces); } private string TagByMonthHighDailyTempRange(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighDailyTempRange, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighDailyTempRange, tagParams, cumulus.TempDPlaces); } private string TagByMonthLowDailyTempRangeT(Dictionary tagParams) @@ -2628,7 +2592,7 @@ private string TagByMonthHighDailyTempRangeT(Dictionary tagParams private string TagByMonthHourlyRainH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HourlyRain, cumulus.RainFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HourlyRain, tagParams, cumulus.RainDPlaces); } private string TagByMonthHourlyRainHt(Dictionary tagParams) @@ -2640,7 +2604,7 @@ private string TagByMonthHourlyRainHt(Dictionary tagParams) private string TagByMonthMonthlyRainH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].MonthlyRain, cumulus.RainFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].MonthlyRain, tagParams, cumulus.RainDPlaces); } private string TagByMonthMonthlyRainHt(Dictionary tagParams) @@ -2652,7 +2616,7 @@ private string TagByMonthMonthlyRainHt(Dictionary tagParams) private string TagByMonthPressH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighPress, cumulus.PressFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighPress, tagParams, cumulus.PressDPlaces); } private string TagByMonthPressHt(Dictionary tagParams) @@ -2664,7 +2628,7 @@ private string TagByMonthPressHt(Dictionary tagParams) private string TagByMonthPressL(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowPress, cumulus.PressFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowPress, tagParams, cumulus.PressDPlaces); } private string TagByMonthPressLt(Dictionary tagParams) @@ -2676,7 +2640,7 @@ private string TagByMonthPressLt(Dictionary tagParams) private string TagByMonthHumH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighHumidity, cumulus.HumFormat); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighHumidity, tagParams, cumulus.HumDPlaces); } private string TagByMonthHumHt(Dictionary tagParams) @@ -2688,7 +2652,7 @@ private string TagByMonthHumHt(Dictionary tagParams) private string TagByMonthHumL(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowHumidity, cumulus.HumFormat); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowHumidity, tagParams, cumulus.HumDPlaces); } private string TagByMonthHumLt(Dictionary tagParams) @@ -2700,7 +2664,7 @@ private string TagByMonthHumLt(Dictionary tagParams) private string TagByMonthMinTempH(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighMinTemp, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].HighMinTemp, tagParams, cumulus.TempDPlaces); } private string TagByMonthMinTempHt(Dictionary tagParams) @@ -2712,7 +2676,7 @@ private string TagByMonthMinTempHt(Dictionary tagParams) private string TagByMonthMaxTempL(Dictionary tagParams) { var month = GetMonthParam(tagParams); - return CheckRc(GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowMaxTemp, cumulus.TempFormat), tagParams); + return GetMonthlyAlltimeValueStr(station.MonthlyRecs[month].LowMaxTemp, tagParams, cumulus.TempDPlaces); } private string TagByMonthMaxTempLt(Dictionary tagParams) @@ -2748,8 +2712,7 @@ private string Taglatitude(Dictionary tagParams) try { - var dp = int.Parse(dpstr); - return CheckRc(string.Format("{0:F" + dp + "}", cumulus.Latitude), tagParams); + return CheckRcDp(cumulus.Latitude, tagParams, 2); } catch { @@ -2768,7 +2731,7 @@ private string Taglongitude(Dictionary tagParams) try { var dp = int.Parse(dpstr); - return CheckRc(String.Format("{0:F" + dp + "}", cumulus.Longitude), tagParams); + return CheckRcDp(cumulus.Longitude, tagParams, 2); } catch { @@ -2996,30 +2959,19 @@ private string TagLatestNoaaYearlyReport(Dictionary tagParams) private string TagMoonPercent(Dictionary tagParams) { - var dpstr = tagParams.Get("dp"); - int i; - var dp = int.TryParse(dpstr, out i) ? i : 0; - - return CheckRc(Math.Round(cumulus.MoonPercent, dp).ToString(), tagParams); + return CheckRcDp(cumulus.MoonPercent, tagParams, 0); } private string TagMoonPercentAbs(Dictionary tagParams) { - var dpstr = tagParams.Get("dp"); - int i; - var dp = int.TryParse(dpstr, out i) ? i : 0; - - return CheckRc(Math.Round(Math.Abs(cumulus.MoonPercent), dp).ToString(), tagParams); + return CheckRcDp(Math.Abs(cumulus.MoonPercent), tagParams, 0); } private string TagMoonAge(Dictionary tagParams) { - var dpstr = tagParams.Get("dp"); var tcstr = tagParams.Get("tc"); - int i; - var dp = int.TryParse(dpstr, out i) ? i : 0; - return tcstr == "y" ? Math.Truncate(cumulus.MoonAge).ToString() : CheckRc(Math.Round(cumulus.MoonAge, dp).ToString(), tagParams); + return tcstr == "y" ? Math.Truncate(cumulus.MoonAge).ToString() : CheckRcDp(cumulus.MoonAge, tagParams, 0); } private string TagLastRainTipIso(Dictionary tagParams) @@ -3153,17 +3105,17 @@ private string TagRCpressTl(Dictionary tagParams) private string TagEt(Dictionary tagParams) { - return CheckRc(station.ET.ToString(cumulus.ETFormat), tagParams); + return CheckRcDp(station.ET, tagParams, cumulus.RainDPlaces + 1); } private string TagLight(Dictionary tagParams) { - return CheckRc(station.LightValue.ToString("F1"), tagParams); + return CheckRcDp(station.LightValue, tagParams, 1); } private string TagUv(Dictionary tagParams) { - return CheckRc(station.UV.ToString(cumulus.UVFormat), tagParams); + return CheckRcDp(station.UV, tagParams, cumulus.UVDPlaces); } private string TagSolarRad(Dictionary tagParams) @@ -3178,34 +3130,27 @@ private string TagCurrentSolarMax(Dictionary tagParams) private string TagSunshineHours(Dictionary tagParams) { - var dpstr = tagParams.Get("dp"); - int i; - var dp = int.TryParse(dpstr, out i) ? i : cumulus.SunshineDPlaces; - - return CheckRc(station.SunshineHours.ToString("F" + dp), tagParams); + return CheckRcDp(station.SunshineHours, tagParams, cumulus.SunshineDPlaces); } private string TagThwIndex(Dictionary tagParams) { - return CheckRc(station.THWIndex.ToString("F1"), tagParams); + return CheckRcDp(station.THWIndex, tagParams, 1); } private string TagThswIndex(Dictionary tagParams) { - return CheckRc(station.THSWIndex.ToString("F1"), tagParams); + return CheckRcDp(station.THSWIndex, tagParams, 1); } private string TagChillHours(Dictionary tagParams) { - return CheckRc(station.ChillHours.ToString("F1"), tagParams); + return CheckRcDp(station.ChillHours, tagParams, 1); } private string TagYSunshineHours(Dictionary tagParams) { - var dpstr = tagParams.Get("dp"); - int i; - var dp = int.TryParse(dpstr, out i) ? i : cumulus.SunshineDPlaces; - return CheckRc(station.YestSunshineHours.ToString("F" + dp), tagParams); + return CheckRcDp(station.YestSunshineHours, tagParams, cumulus.SunshineDPlaces); } private string TagIsSunny(Dictionary tagParams) @@ -3236,232 +3181,232 @@ private string TagConsecutiveDryDays(Dictionary tagParams) // Extra sensors private string TagExtraTemp1(Dictionary tagParams) { - return CheckRc(station.ExtraTemp[1].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraTemp[1], tagParams, cumulus.TempDPlaces); } private string TagExtraTemp2(Dictionary tagParams) { - return CheckRc(station.ExtraTemp[2].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraTemp[2], tagParams, cumulus.TempDPlaces); } private string TagExtraTemp3(Dictionary tagParams) { - return CheckRc(station.ExtraTemp[3].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraTemp[3], tagParams, cumulus.TempDPlaces); } private string TagExtraTemp4(Dictionary tagParams) { - return CheckRc(station.ExtraTemp[4].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraTemp[4], tagParams, cumulus.TempDPlaces); } private string TagExtraTemp5(Dictionary tagParams) { - return CheckRc(station.ExtraTemp[5].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraTemp[5], tagParams, cumulus.TempDPlaces); } private string TagExtraTemp6(Dictionary tagParams) { - return CheckRc(station.ExtraTemp[6].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraTemp[6], tagParams, cumulus.TempDPlaces); } private string TagExtraTemp7(Dictionary tagParams) { - return CheckRc(station.ExtraTemp[7].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraTemp[7], tagParams, cumulus.TempDPlaces); } private string TagExtraTemp8(Dictionary tagParams) { - return CheckRc(station.ExtraTemp[8].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraTemp[8], tagParams, cumulus.TempDPlaces); } private string TagExtraTemp9(Dictionary tagParams) { - return CheckRc(station.ExtraTemp[9].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraTemp[9], tagParams, cumulus.TempDPlaces); } private string TagExtraTemp10(Dictionary tagParams) { - return CheckRc(station.ExtraTemp[10].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraTemp[10], tagParams, cumulus.TempDPlaces); } private string TagExtraDp1(Dictionary tagParams) { - return CheckRc(station.ExtraDewPoint[1].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraDewPoint[1], tagParams, cumulus.TempDPlaces); } private string TagExtraDp2(Dictionary tagParams) { - return CheckRc(station.ExtraDewPoint[2].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraDewPoint[2], tagParams, cumulus.TempDPlaces); } private string TagExtraDp3(Dictionary tagParams) { - return CheckRc(station.ExtraDewPoint[3].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraDewPoint[3], tagParams, cumulus.TempDPlaces); } private string TagExtraDp4(Dictionary tagParams) { - return CheckRc(station.ExtraDewPoint[4].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraDewPoint[4], tagParams, cumulus.TempDPlaces); } private string TagExtraDp5(Dictionary tagParams) { - return CheckRc(station.ExtraDewPoint[5].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraDewPoint[5], tagParams, cumulus.TempDPlaces); } private string TagExtraDp6(Dictionary tagParams) { - return CheckRc(station.ExtraDewPoint[6].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraDewPoint[6], tagParams, cumulus.TempDPlaces); } private string TagExtraDp7(Dictionary tagParams) { - return CheckRc(station.ExtraDewPoint[7].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraDewPoint[7], tagParams, cumulus.TempDPlaces); } private string TagExtraDp8(Dictionary tagParams) { - return CheckRc(station.ExtraDewPoint[8].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraDewPoint[8], tagParams, cumulus.TempDPlaces); } private string TagExtraDp9(Dictionary tagParams) { - return CheckRc(station.ExtraDewPoint[9].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraDewPoint[9], tagParams, cumulus.TempDPlaces); } private string TagExtraDp10(Dictionary tagParams) { - return CheckRc(station.ExtraDewPoint[10].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ExtraDewPoint[10], tagParams, cumulus.TempDPlaces); } private string TagExtraHum1(Dictionary tagParams) { - return CheckRc(station.ExtraHum[1].ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.ExtraHum[1], tagParams, cumulus.HumDPlaces); } private string TagExtraHum2(Dictionary tagParams) { - return CheckRc(station.ExtraHum[2].ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.ExtraHum[2], tagParams, cumulus.HumDPlaces); } private string TagExtraHum3(Dictionary tagParams) { - return CheckRc(station.ExtraHum[3].ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.ExtraHum[3], tagParams, cumulus.HumDPlaces); } private string TagExtraHum4(Dictionary tagParams) { - return CheckRc(station.ExtraHum[4].ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.ExtraHum[4], tagParams, cumulus.HumDPlaces); } private string TagExtraHum5(Dictionary tagParams) { - return CheckRc(station.ExtraHum[5].ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.ExtraHum[5], tagParams, cumulus.HumDPlaces); } private string TagExtraHum6(Dictionary tagParams) { - return CheckRc(station.ExtraHum[6].ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.ExtraHum[6], tagParams, cumulus.HumDPlaces); } private string TagExtraHum7(Dictionary tagParams) { - return CheckRc(station.ExtraHum[7].ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.ExtraHum[7], tagParams, cumulus.HumDPlaces); } private string TagExtraHum8(Dictionary tagParams) { - return CheckRc(station.ExtraHum[8].ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.ExtraHum[8], tagParams, cumulus.HumDPlaces); } private string TagExtraHum9(Dictionary tagParams) { - return CheckRc(station.ExtraHum[9].ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.ExtraHum[9], tagParams, cumulus.HumDPlaces); } private string TagExtraHum10(Dictionary tagParams) { - return CheckRc(station.ExtraHum[10].ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.ExtraHum[10], tagParams, cumulus.HumDPlaces); } private string TagSoilTemp1(Dictionary tagParams) { - return CheckRc(station.SoilTemp1.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp1, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp2(Dictionary tagParams) { - return CheckRc(station.SoilTemp2.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp2, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp3(Dictionary tagParams) { - return CheckRc(station.SoilTemp3.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp3, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp4(Dictionary tagParams) { - return CheckRc(station.SoilTemp4.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp4, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp5(Dictionary tagParams) { - return CheckRc(station.SoilTemp5.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp5, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp6(Dictionary tagParams) { - return CheckRc(station.SoilTemp6.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp6, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp7(Dictionary tagParams) { - return CheckRc(station.SoilTemp7.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp7, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp8(Dictionary tagParams) { - return CheckRc(station.SoilTemp8.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp8, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp9(Dictionary tagParams) { - return CheckRc(station.SoilTemp9.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp9, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp10(Dictionary tagParams) { - return CheckRc(station.SoilTemp10.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp10, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp11(Dictionary tagParams) { - return CheckRc(station.SoilTemp11.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp11, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp12(Dictionary tagParams) { - return CheckRc(station.SoilTemp12.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp12, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp13(Dictionary tagParams) { - return CheckRc(station.SoilTemp13.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp13, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp14(Dictionary tagParams) { - return CheckRc(station.SoilTemp14.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp14, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp15(Dictionary tagParams) { - return CheckRc(station.SoilTemp15.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp15, tagParams, cumulus.TempDPlaces); } private string TagSoilTemp16(Dictionary tagParams) { - return CheckRc(station.SoilTemp16.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.SoilTemp16, tagParams, cumulus.TempDPlaces); } private string TagSoilMoisture1(Dictionary tagParams) @@ -3546,82 +3491,82 @@ private string TagSoilMoisture16(Dictionary tagParams) private string TagUserTemp1(Dictionary tagParams) { - return CheckRc(station.UserTemp[1].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.UserTemp[1], tagParams, cumulus.TempDPlaces); } private string TagUserTemp2(Dictionary tagParams) { - return CheckRc(station.UserTemp[2].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.UserTemp[2], tagParams, cumulus.TempDPlaces); } private string TagUserTemp3(Dictionary tagParams) { - return CheckRc(station.UserTemp[3].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.UserTemp[3], tagParams, cumulus.TempDPlaces); } private string TagUserTemp4(Dictionary tagParams) { - return CheckRc(station.UserTemp[4].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.UserTemp[4], tagParams, cumulus.TempDPlaces); } private string TagUserTemp5(Dictionary tagParams) { - return CheckRc(station.UserTemp[5].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.UserTemp[5], tagParams, cumulus.TempDPlaces); } private string TagUserTemp6(Dictionary tagParams) { - return CheckRc(station.UserTemp[6].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.UserTemp[6], tagParams, cumulus.TempDPlaces); } private string TagUserTemp7(Dictionary tagParams) { - return CheckRc(station.UserTemp[7].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.UserTemp[7], tagParams, cumulus.TempDPlaces); } private string TagUserTemp8(Dictionary tagParams) { - return CheckRc(station.UserTemp[8].ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.UserTemp[8], tagParams, cumulus.TempDPlaces); } private string TagAirQuality1(Dictionary tagParams) { - return CheckRc(station.AirQuality1.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.AirQuality1, tagParams, cumulus.AirQualityDPlaces); } private string TagAirQuality2(Dictionary tagParams) { - return CheckRc(station.AirQuality2.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.AirQuality2, tagParams, cumulus.AirQualityDPlaces); } private string TagAirQuality3(Dictionary tagParams) { - return CheckRc(station.AirQuality3.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.AirQuality3, tagParams, cumulus.AirQualityDPlaces); } private string TagAirQuality4(Dictionary tagParams) { - return CheckRc(station.AirQuality4.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.AirQuality4, tagParams, cumulus.AirQualityDPlaces); } private string TagAirQualityAvg1(Dictionary tagParams) { - return CheckRc(station.AirQualityAvg1.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.AirQualityAvg1, tagParams, cumulus.AirQualityDPlaces); } private string TagAirQualityAvg2(Dictionary tagParams) { - return CheckRc(station.AirQualityAvg2.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.AirQualityAvg2, tagParams, cumulus.AirQualityDPlaces); } private string TagAirQualityAvg3(Dictionary tagParams) { - return CheckRc(station.AirQuality3.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.AirQuality3, tagParams, cumulus.AirQualityDPlaces); } private string TagAirQualityAvg4(Dictionary tagParams) { - return CheckRc(station.AirQualityAvg4.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.AirQualityAvg4, tagParams, cumulus.AirQualityDPlaces); } private string TagCo2(Dictionary tagParams) @@ -3636,52 +3581,52 @@ private string TagCO2_24h(Dictionary tagParams) private string TagCO2_pm2p5(Dictionary tagParams) { - return CheckRc(station.CO2_pm2p5.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.CO2_pm2p5, tagParams, cumulus.AirQualityDPlaces); } private string TagCO2_pm2p5_24h(Dictionary tagParams) { - return CheckRc(station.CO2_pm2p5_24h.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.CO2_pm2p5_24h, tagParams, cumulus.AirQualityDPlaces); } private string TagCO2_pm10(Dictionary tagParams) { - return CheckRc(station.CO2_pm10.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.CO2_pm10, tagParams, cumulus.AirQualityDPlaces); } private string TagCO2_pm10_24h(Dictionary tagParams) { - return CheckRc(station.CO2_pm10_24h.ToString(cumulus.AirQualityFormat), tagParams); + return CheckRcDp(station.CO2_pm10_24h, tagParams, cumulus.AirQualityDPlaces); } private string TagC02_temp(Dictionary tagParams) { - return CheckRc(station.CO2_temperature.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.CO2_temperature, tagParams, cumulus.TempDPlaces); } private string TagC02_hum(Dictionary tagParams) { - return CheckRc(station.CO2_humidity.ToString(cumulus.HumFormat), tagParams); + return CheckRcDp(station.CO2_humidity, tagParams, cumulus.HumDPlaces); } private string TagLeafTemp1(Dictionary tagParams) { - return CheckRc(station.LeafTemp1.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.LeafTemp1, tagParams, cumulus.TempDPlaces); } private string TagLeafTemp2(Dictionary tagParams) { - return CheckRc(station.LeafTemp2.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.LeafTemp2, tagParams, cumulus.TempDPlaces); } private string TagLeafTemp3(Dictionary tagParams) { - return CheckRc(station.LeafTemp3.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.LeafTemp3, tagParams, cumulus.TempDPlaces); } private string TagLeafTemp4(Dictionary tagParams) { - return CheckRc(station.LeafTemp4.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.LeafTemp4, tagParams, cumulus.TempDPlaces); } private string TagLeakSensor1(Dictionary tagParams) @@ -3706,7 +3651,7 @@ private string TagLeakSensor4(Dictionary tagParams) private string TagLightningDistance(Dictionary tagParams) { - return station.LightningDistance == 999 ? "--" : CheckRc(station.LightningDistance.ToString(cumulus.WindRunFormat), tagParams); + return station.LightningDistance == 999 ? "--" : CheckRcDp(station.LightningDistance, tagParams, cumulus.WindRunDPlaces); } private string TagLightningTime(Dictionary tagParams) @@ -3914,77 +3859,77 @@ private string TagUpgradeAlarm(Dictionary tagParams) // Monthly highs and lows - values private string TagMonthTempH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthTempL(Dictionary tagParams) { - return CheckRc(station.ThisMonth.LowTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.LowTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthHeatIndexH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighHeatIndex.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighHeatIndex.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthWChillL(Dictionary tagParams) { - return CheckRc(station.ThisMonth.LowChill.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.LowChill.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthAppTempH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighAppTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighAppTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthAppTempL(Dictionary tagParams) { - return CheckRc(station.ThisMonth.LowAppTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.LowAppTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthFeelsLikeH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighFeelsLike.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighFeelsLike.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthFeelsLikeL(Dictionary tagParams) { - return CheckRc(station.ThisMonth.LowFeelsLike.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.LowFeelsLike.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthHumidexH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighHumidex.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighHumidex.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthDewPointH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighDewPoint.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighDewPoint.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthDewPointL(Dictionary tagParams) { - return CheckRc(station.ThisMonth.LowDewPoint.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisMonth.LowDewPoint.Val, tagParams, cumulus.TempDPlaces); } private string TagMonthMinTempH(Dictionary tagParams) { - return station.ThisMonth.HighMinTemp.Val > -999 ? CheckRc(station.ThisMonth.HighMinTemp.Val.ToString(cumulus.TempFormat), tagParams) : "--"; + return station.ThisMonth.HighMinTemp.Val > -999 ? CheckRcDp(station.ThisMonth.HighMinTemp.Val, tagParams, cumulus.TempDPlaces) : "--"; } private string TagMonthMaxTempL(Dictionary tagParams) { - return station.ThisMonth.LowMaxTemp.Val < 999 ? CheckRc(station.ThisMonth.LowMaxTemp.Val.ToString(cumulus.TempFormat), tagParams) : "--"; + return station.ThisMonth.LowMaxTemp.Val < 999 ? CheckRcDp(station.ThisMonth.LowMaxTemp.Val, tagParams, cumulus.TempDPlaces) : "--"; } private string TagMonthPressH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighPress.Val.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighPress.Val, tagParams, cumulus.PressDPlaces); } private string TagMonthPressL(Dictionary tagParams) { - return CheckRc(station.ThisMonth.LowPress.Val.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.ThisMonth.LowPress.Val, tagParams, cumulus.PressDPlaces); } private string TagMonthHumH(Dictionary tagParams) @@ -3999,32 +3944,32 @@ private string TagMonthHumL(Dictionary tagParams) private string TagMonthGustH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighGust.Val.ToString(cumulus.WindFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighGust.Val, tagParams, cumulus.WindDPlaces); } private string TagMonthWindH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighWind.Val.ToString(cumulus.WindAvgFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighWind.Val, tagParams, cumulus.WindAvgDPlaces); } private string TagMonthWindRunH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighWindRun.Val.ToString(cumulus.WindRunFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighWindRun.Val, tagParams, cumulus.WindRunDPlaces); } private string TagMonthRainRateH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HighRainRate.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.ThisMonth.HighRainRate.Val, tagParams, cumulus.RainDPlaces); } private string TagMonthHourlyRainH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.HourlyRain.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.ThisMonth.HourlyRain.Val, tagParams, cumulus.RainDPlaces); } private string TagMonthDailyRainH(Dictionary tagParams) { - return CheckRc(station.ThisMonth.DailyRain.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.ThisMonth.DailyRain.Val, tagParams, cumulus.RainDPlaces); } private string TagMonthLongestDryPeriod(Dictionary tagParams) @@ -4039,12 +3984,12 @@ private string TagMonthLongestWetPeriod(Dictionary tagParams) private string TagMonthHighDailyTempRange(Dictionary tagParams) { - return station.ThisMonth.HighDailyTempRange.Val > -999 ? CheckRc(station.ThisMonth.HighDailyTempRange.Val.ToString(cumulus.TempFormat), tagParams) : "--"; + return station.ThisMonth.HighDailyTempRange.Val > -999 ? CheckRcDp(station.ThisMonth.HighDailyTempRange.Val, tagParams, cumulus.TempDPlaces) : "--"; } private string TagMonthLowDailyTempRange(Dictionary tagParams) { - return station.ThisMonth.LowDailyTempRange.Val < 999 ? CheckRc(station.ThisMonth.LowDailyTempRange.Val.ToString(cumulus.TempFormat), tagParams) : "--"; + return station.ThisMonth.LowDailyTempRange.Val < 999 ? CheckRcDp(station.ThisMonth.LowDailyTempRange.Val, tagParams, cumulus.TempDPlaces) : "--"; } // Monthly highs and lows - times @@ -4282,77 +4227,77 @@ private string TagMonthLongestWetPeriodD(Dictionary tagParams) // Yearly highs and lows - values private string TagYearTempH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.HighTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagYearTempL(Dictionary tagParams) { - return CheckRc(station.ThisYear.LowTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.LowTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagYearHeatIndexH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighHeatIndex.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.HighHeatIndex.Val, tagParams, cumulus.TempDPlaces); } private string TagYearWChillL(Dictionary tagParams) { - return CheckRc(station.ThisYear.LowChill.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.LowChill.Val, tagParams, cumulus.TempDPlaces); } private string TagYearAppTempH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighAppTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.HighAppTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagYearAppTempL(Dictionary tagParams) { - return CheckRc(station.ThisYear.LowAppTemp.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.LowAppTemp.Val, tagParams, cumulus.TempDPlaces); } private string TagYearFeelsLikeH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighFeelsLike.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.HighFeelsLike.Val, tagParams, cumulus.TempDPlaces); } private string TagYearFeelsLikeL(Dictionary tagParams) { - return CheckRc(station.ThisYear.LowFeelsLike.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.LowFeelsLike.Val, tagParams, cumulus.TempDPlaces); } private string TagYearHumidexH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighHumidex.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.HighHumidex.Val, tagParams, cumulus.TempDPlaces); } private string TagYearDewPointH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighDewPoint.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.HighDewPoint.Val, tagParams, cumulus.TempDPlaces); } private string TagYearDewPointL(Dictionary tagParams) { - return CheckRc(station.ThisYear.LowDewPoint.Val.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(station.ThisYear.LowDewPoint.Val, tagParams, cumulus.TempDPlaces); } private string TagYearMinTempH(Dictionary tagParams) { - return station.ThisYear.HighMinTemp.Val > -999 ? CheckRc(station.ThisYear.HighMinTemp.Val.ToString(cumulus.TempFormat), tagParams) : "--"; + return station.ThisYear.HighMinTemp.Val > -999 ? CheckRcDp(station.ThisYear.HighMinTemp.Val, tagParams, cumulus.TempDPlaces) : "--"; } private string TagYearMaxTempL(Dictionary tagParams) { - return station.ThisYear.LowMaxTemp.Val < 999 ? CheckRc(station.ThisYear.LowMaxTemp.Val.ToString(cumulus.TempFormat), tagParams) : "--"; + return station.ThisYear.LowMaxTemp.Val < 999 ? CheckRcDp(station.ThisYear.LowMaxTemp.Val, tagParams, cumulus.TempDPlaces) : "--"; } private string TagYearPressH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighPress.Val.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.ThisYear.HighPress.Val, tagParams, cumulus.PressDPlaces); } private string TagYearPressL(Dictionary tagParams) { - return CheckRc(station.ThisYear.LowPress.Val.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(station.ThisYear.LowPress.Val, tagParams, cumulus.PressDPlaces); } private string TagYearHumH(Dictionary tagParams) @@ -4367,32 +4312,32 @@ private string TagYearHumL(Dictionary tagParams) private string TagYearGustH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighGust.Val.ToString(cumulus.WindFormat), tagParams); + return CheckRcDp(station.ThisYear.HighGust.Val, tagParams, cumulus.WindDPlaces); } private string TagYearWindH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighWind.Val.ToString(cumulus.WindAvgFormat), tagParams); + return CheckRcDp(station.ThisYear.HighWind.Val, tagParams, cumulus.WindAvgDPlaces); } private string TagYearWindRunH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighWindRun.Val.ToString(cumulus.WindRunFormat), tagParams); + return CheckRcDp(station.ThisYear.HighWindRun.Val, tagParams, cumulus.WindRunDPlaces); } private string TagYearRainRateH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HighRainRate.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.ThisYear.HighRainRate.Val, tagParams, cumulus.RainDPlaces); } private string TagYearHourlyRainH(Dictionary tagParams) { - return CheckRc(station.ThisYear.HourlyRain.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.ThisYear.HourlyRain.Val, tagParams, cumulus.RainDPlaces); } private string TagYearDailyRainH(Dictionary tagParams) { - return CheckRc(station.ThisYear.DailyRain.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.ThisYear.DailyRain.Val, tagParams, cumulus.RainDPlaces); } private string TagYearLongestDryPeriod(Dictionary tagParams) @@ -4407,17 +4352,17 @@ private string TagYearLongestWetPeriod(Dictionary tagParams) private string TagYearHighDailyTempRange(Dictionary tagParams) { - return station.ThisYear.HighDailyTempRange.Val > -999 ? CheckRc(station.ThisYear.HighDailyTempRange.Val.ToString(cumulus.TempFormat), tagParams) : "--"; + return station.ThisYear.HighDailyTempRange.Val > -999 ? CheckRcDp(station.ThisYear.HighDailyTempRange.Val, tagParams, cumulus.TempDPlaces) : "--"; } private string TagYearLowDailyTempRange(Dictionary tagParams) { - return station.ThisYear.LowDailyTempRange.Val < 999 ? CheckRc(station.ThisYear.LowDailyTempRange.Val.ToString(cumulus.TempFormat), tagParams) : "--"; + return station.ThisYear.LowDailyTempRange.Val < 999 ? CheckRcDp(station.ThisYear.LowDailyTempRange.Val, tagParams, cumulus.TempDPlaces) : "--"; } private string TagYearMonthlyRainH(Dictionary tagParams) { - return CheckRc(station.ThisYear.MonthlyRain.Val.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(station.ThisYear.MonthlyRain.Val, tagParams, cumulus.RainDPlaces); } // Yearly highs and lows - times @@ -4840,7 +4785,7 @@ private string TagRecentOutsideTemp(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.OutdoorTemperature.ToString(cumulus.TempFormat) : result[0].OutsideTemp.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.OutdoorTemperature : result[0].OutsideTemp, tagParams, cumulus.TempDPlaces); } private string TagRecentWindSpeed(Dictionary tagParams) @@ -4849,7 +4794,7 @@ private string TagRecentWindSpeed(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.WindAverage.ToString(cumulus.WindAvgFormat) : result[0].WindSpeed.ToString(cumulus.WindAvgFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.WindAverage : result[0].WindSpeed, tagParams, cumulus.WindAvgDPlaces); } private string TagRecentWindGust(Dictionary tagParams) @@ -4858,7 +4803,7 @@ private string TagRecentWindGust(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.RecentMaxGust.ToString(cumulus.WindFormat) : result[0].WindGust.ToString(cumulus.WindFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.RecentMaxGust : result[0].WindGust, tagParams, cumulus.WindDPlaces); } private string TagRecentWindLatest(Dictionary tagParams) @@ -4867,7 +4812,7 @@ private string TagRecentWindLatest(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.WindLatest.ToString(cumulus.WindFormat) : result[0].WindLatest.ToString(cumulus.WindFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.WindLatest : result[0].WindLatest, tagParams, cumulus.WindDPlaces); } private string TagRecentWindDir(Dictionary tagParams) @@ -4894,7 +4839,7 @@ private string TagRecentWindChill(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.WindChill.ToString(cumulus.TempFormat) : result[0].WindChill.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.WindChill : result[0].WindChill, tagParams, cumulus.TempDPlaces); } private string TagRecentDewPoint(Dictionary tagParams) @@ -4903,7 +4848,7 @@ private string TagRecentDewPoint(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.OutdoorDewpoint.ToString(cumulus.TempFormat) : result[0].DewPoint.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.OutdoorDewpoint : result[0].DewPoint, tagParams, cumulus.TempDPlaces); } private string TagRecentHeatIndex(Dictionary tagParams) @@ -4912,7 +4857,7 @@ private string TagRecentHeatIndex(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.HeatIndex.ToString(cumulus.TempFormat) : result[0].HeatIndex.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.HeatIndex : result[0].HeatIndex, tagParams, cumulus.TempDPlaces); } private string TagRecentFeelsLike(Dictionary tagParams) @@ -4921,7 +4866,7 @@ private string TagRecentFeelsLike(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.FeelsLike.ToString(cumulus.TempFormat) : result[0].FeelsLike.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.FeelsLike : result[0].FeelsLike, tagParams, cumulus.TempDPlaces); } private string TagRecentHumidex(Dictionary tagParams) @@ -4930,7 +4875,7 @@ private string TagRecentHumidex(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.Humidex.ToString(cumulus.TempFormat) : result[0].Humidex.ToString(cumulus.TempFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.Humidex : result[0].Humidex, tagParams, cumulus.TempDPlaces); } private string TagRecentHumidity(Dictionary tagParams) @@ -4948,7 +4893,7 @@ private string TagRecentPressure(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.Pressure.ToString(cumulus.PressFormat) : result[0].Pressure.ToString(cumulus.PressFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.Pressure : result[0].Pressure, tagParams, cumulus.PressDPlaces); } private string TagRecentRainToday(Dictionary tagParams) @@ -4957,7 +4902,7 @@ private string TagRecentRainToday(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.RainToday.ToString(cumulus.RainFormat) : result[0].RainToday.ToString(cumulus.RainFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.RainToday : result[0].RainToday, tagParams, cumulus.RainDPlaces); } private string TagRecentSolarRad(Dictionary tagParams) @@ -4975,7 +4920,7 @@ private string TagRecentUv(Dictionary tagParams) var result = station.RecentDataDb.Query("select * from RecentData where Timestamp >= ? order by Timestamp limit 1", recentTs); - return CheckRc(result.Count == 0 ? station.UV.ToString(cumulus.UVFormat) : result[0].UV.ToString(cumulus.UVFormat), tagParams); + return CheckRcDp(result.Count == 0 ? station.UV : result[0].UV, tagParams, cumulus.UVDPlaces); } private string TagRecentTs(Dictionary tagParams) diff --git a/Updates.txt b/Updates.txt index ac601287..4f28904d 100644 --- a/Updates.txt +++ b/Updates.txt @@ -5,6 +5,7 @@ - New: Now determines the Ecowitt GW1000 device main sensor type (WH65/WH24) and prints system information to the log file - New: Adds the free text station model to the Station settings page - New: Adds a cache buster to default web site webpagedata.json downloads +- New: All decimal web tag values now accept a dp=N and tc=y overrides for the number of decimal places 3.10.4 - b3121 From e0a7d66d074da361f11e2559d5adf7ed732cb250 Mon Sep 17 00:00:00 2001 From: Mark Crossley <1196094+mcrossley@users.noreply.github.com> Date: Thu, 1 Apr 2021 18:05:36 +0100 Subject: [PATCH 5/6] - Fix: Occasional GW1000 crash on GetSensorIdsNew response timeout - Fix: GW1000, WH40 rain gauge, removed battery status check as it does not send this information - Fix: Adds missing WeatherCloud interval setting to Internet Settings - New: Adds option to upload AQ data to WeatherCloud --- CumulusMX/Cumulus.cs | 4 ++++ CumulusMX/FOStation.cs | 20 +++-------------- CumulusMX/GW1000Station.cs | 9 +++++--- CumulusMX/InternetSettings.cs | 6 +++++ CumulusMX/WeatherStation.cs | 41 ++++++++++++++++++++++++++++++++++- Updates.txt | 5 +++++ 6 files changed, 64 insertions(+), 21 deletions(-) diff --git a/CumulusMX/Cumulus.cs b/CumulusMX/Cumulus.cs index e1929de6..73236ffa 100644 --- a/CumulusMX/Cumulus.cs +++ b/CumulusMX/Cumulus.cs @@ -1118,6 +1118,7 @@ public Cumulus(int HTTPport, bool DebugEnabled, string startParms) //LogDB.CreateTable(); // Open diary database (create file if it doesn't exist) + //DiaryDB = new SQLiteConnection(diaryfile, flags, true); // We should be using this - storing datetime as ticks, but historically string storage has been used, so we are stuck with it? DiaryDB = new SQLiteConnection(diaryfile, flags); DiaryDB.CreateTable(); @@ -3971,6 +3972,7 @@ private void ReadIniFile() WCloud.Interval = ini.GetValue("WeatherCloud", "Interval", WCloud.DefaultInterval); WCloud.SendUV = ini.GetValue("WeatherCloud", "SendUV", false); WCloud.SendSolar = ini.GetValue("WeatherCloud", "SendSR", false); + WCloud.SendAQI = ini.GetValue("WeatherCloud", "SendAQI", false); WCloud.SynchronisedUpdate = (60 % WCloud.Interval == 0); @@ -4707,6 +4709,7 @@ internal void WriteIniFile() ini.SetValue("WeatherCloud", "Interval", WCloud.Interval); ini.SetValue("WeatherCloud", "SendUV", WCloud.SendUV); ini.SetValue("WeatherCloud", "SendSR", WCloud.SendSolar); + ini.SetValue("WeatherCloud", "SendAQI", WCloud.SendAQI); ini.SetValue("Twitter", "User", Twitter.ID); ini.SetValue("Twitter", "Password", Twitter.PW); @@ -9621,6 +9624,7 @@ public class WebUploadService public bool SendUV; public bool SendSolar; public bool SendIndoor; + public bool SendAQI; public bool CatchUp; public bool CatchingUp; public bool Updating; diff --git a/CumulusMX/FOStation.cs b/CumulusMX/FOStation.cs index 79a76808..d6e4acc3 100644 --- a/CumulusMX/FOStation.cs +++ b/CumulusMX/FOStation.cs @@ -234,15 +234,8 @@ public override void getAndProcessHistoryData() cumulus.LogMessage(msg); - msg = "Data block: "; - for (int i = 0; i < numBytes; i++) - { - msg += data[i].ToString("X2"); - msg += " "; - } - - cumulus.LogDataMessage(msg); + cumulus.LogDataMessage("Data block: " + BitConverter.ToString(data, 0, numBytes)); histData.timestamp = timestamp; histData.interval = interval; @@ -601,11 +594,9 @@ private void ReadAddress(int address, byte[] buff) cumulus.LogMessage("Error reading data from station - it may need resetting"); } - var recData = " Data" + i + ": "; + var recData = " Data" + i + ": " + BitConverter.ToString(response, startByte, responseLength - startByte); for (int j = startByte; j < responseLength; j++) { - recData += response[j].ToString("X2"); - recData += " "; buff[ptr++] = response[j]; } cumulus.LogDataMessage(recData); @@ -759,12 +750,7 @@ private void GetAndProcessData() if ((!synchronising) || ((readCounter%20) == 0)) { - LatestFOReading = addr.ToString("X4") + ":"; - for (int i = 0; i < 16; i++) - { - LatestFOReading = LatestFOReading + " " + data[i].ToString("X2"); - } - + LatestFOReading = addr.ToString("X4") + ": " + BitConverter.ToString(data, 0, 16); cumulus.LogDataMessage(LatestFOReading); // Indoor Humidity ==================================================== diff --git a/CumulusMX/GW1000Station.cs b/CumulusMX/GW1000Station.cs index 0144f757..1a15c78a 100644 --- a/CumulusMX/GW1000Station.cs +++ b/CumulusMX/GW1000Station.cs @@ -708,12 +708,12 @@ private bool GetSensorIdsNew() // ... etc // (??) - 0x?? - checksum - var len = ConvertBigEndianUInt16(data, 3); - var batteryLow = false; if (null != data && data.Length > 200) { + var len = ConvertBigEndianUInt16(data, 3); + for (int i = 5; i < len; i += 7) { if (PrintSensorInfoNew(data, i)) @@ -778,9 +778,12 @@ private bool PrintSensorInfoNew(byte[] data, int idx) string batt; switch (type) { + case "WH40": // WH40 does not send any battery info :( + batt = "n/a"; + break; + case "WH65": case "WH24": - case "WH40": case "WH26": batt = TestBattery1(data[battPos], 1); // 0 or 1 break; diff --git a/CumulusMX/InternetSettings.cs b/CumulusMX/InternetSettings.cs index 96627424..f8352ee8 100644 --- a/CumulusMX/InternetSettings.cs +++ b/CumulusMX/InternetSettings.cs @@ -275,8 +275,10 @@ public string UpdateInternetConfig(IHttpContext context) { cumulus.WCloud.ID = settings.weathercloud.wid ?? string.Empty; cumulus.WCloud.PW = settings.weathercloud.key ?? string.Empty; + cumulus.WCloud.Interval = settings.weathercloud.interval; cumulus.WCloud.SendSolar = settings.weathercloud.includesolar; cumulus.WCloud.SendUV = settings.weathercloud.includeuv; + cumulus.WCloud.SendAQI = settings.weathercloud.includeaqi; cumulus.WCloud.SynchronisedUpdate = (60 % cumulus.WCloud.Interval == 0); cumulus.WCloudTimer.Interval = cumulus.WCloud.Interval * 60 * 1000; @@ -727,8 +729,10 @@ public string GetInternetAlpacaFormData() var wcloudsettings = new JsonInternetSettingsWCloud() { enabled = cumulus.WCloud.Enabled, + interval = cumulus.WCloud.Interval, includesolar = cumulus.WCloud.SendSolar, includeuv = cumulus.WCloud.SendUV, + includeaqi = cumulus.WCloud.SendAQI, key = cumulus.WCloud.PW, wid = cumulus.WCloud.ID }; @@ -1134,8 +1138,10 @@ public class JsonInternetSettingsAwekas public class JsonInternetSettingsWCloud { public bool enabled { get; set; } + public int interval { get; set; } public bool includeuv { get; set; } public bool includesolar { get; set; } + public bool includeaqi { get; set; } public string wid { get; set; } public string key { get; set; } } diff --git a/CumulusMX/WeatherStation.cs b/CumulusMX/WeatherStation.cs index 05b5da75..5ab0ce3c 100644 --- a/CumulusMX/WeatherStation.cs +++ b/CumulusMX/WeatherStation.cs @@ -8441,7 +8441,7 @@ public void SetDefaultYearlyHighsAndLows() public string GetWCloudURL(out string pwstring, DateTime timestamp) { pwstring = cumulus.WCloud.PW; - StringBuilder sb = new StringBuilder($"http://api.weathercloud.net/v01/set?wid={cumulus.WCloud.ID}&key={pwstring}"); + StringBuilder sb = new StringBuilder($"https://api.weathercloud.net/v01/set?wid={cumulus.WCloud.ID}&key={pwstring}"); //Temperature sb.Append("&tempin=" + (int)Math.Round(ConvertUserTempToC(IndoorTemperature) * 10)); @@ -8488,6 +8488,45 @@ public string GetWCloudURL(out string pwstring, DateTime timestamp) sb.Append("&uvi=" + (int)Math.Round(UV * 10)); } + // aq + if (cumulus.WCloud.SendAQI) + { + sb.Append("&"); + + switch (cumulus.StationOptions.PrimaryAqSensor) + { + case (int)Cumulus.PrimaryAqSensor.AirLinkOutdoor: + if (cumulus.airLinkDataOut != null) + { + sb.Append($"pm25={cumulus.airLinkDataOut.pm2p5:F0}"); + sb.Append($"&pm10={cumulus.airLinkDataOut.pm10:F0}"); + sb.Append($"&aqi={AirQualityIndices.US_EPApm2p5(cumulus.airLinkDataOut.pm2p5_24hr)}"); + } + break; + case (int)Cumulus.PrimaryAqSensor.Ecowitt1: + sb.Append($"pm25={AirQuality1:F0}"); + sb.Append($"&aqi={AirQualityIndices.US_EPApm2p5(AirQualityAvg1)}"); + break; + case (int)Cumulus.PrimaryAqSensor.Ecowitt2: + sb.Append($"pm25={AirQuality2:F0}"); + sb.Append($"&aqi={AirQualityIndices.US_EPApm2p5(AirQualityAvg2)}"); + break; + case (int)Cumulus.PrimaryAqSensor.Ecowitt3: + sb.Append($"pm25={AirQuality3:F0}"); + sb.Append($"&aqi={AirQualityIndices.US_EPApm2p5(AirQualityAvg3)}"); + break; + case (int)Cumulus.PrimaryAqSensor.Ecowitt4: + sb.Append($"pm25={AirQuality4:F0}"); + sb.Append($"&aqi={AirQualityIndices.US_EPApm2p5(AirQualityAvg4)}"); + break; + case (int)Cumulus.PrimaryAqSensor.EcowittCO2: + sb.Append($"pm25={CO2_pm2p5:F0}"); + sb.Append($"&pm10={CO2_pm10:F0}"); + sb.Append($"&aqi={AirQualityIndices.US_EPApm2p5(CO2_pm2p5_24h)}"); + break; + } + } + // time sb.Append("&time=" + timestamp.ToString("HHmm")); diff --git a/Updates.txt b/Updates.txt index 4f28904d..52206fe7 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,11 +1,16 @@ 3.10.5 - b3122 —————————————— - Fix: Comma decimal issues with OpenWeatherMap and other third party uploads +- Fix: Occasional GW1000 crash on GetSensorIdsNew response timeout +- Fix: GW1000, WH40 rain gauge, removed battery status check as it does not send this information +- Fix: Adds missing WeatherCloud interval setting to Internet Settings - New: Now determines the Ecowitt GW1000 device main sensor type (WH65/WH24) and prints system information to the log file - New: Adds the free text station model to the Station settings page - New: Adds a cache buster to default web site webpagedata.json downloads +- New: Adds optional UV index to Now, Today, Yesterday pages of the default web site - New: All decimal web tag values now accept a dp=N and tc=y overrides for the number of decimal places +- New: Adds option to upload AQ data to WeatherCloud 3.10.4 - b3121 From 6d012664de977ed4420d4f9992b0431e7d975c1f Mon Sep 17 00:00:00 2001 From: Mark Crossley <1196094+mcrossley@users.noreply.github.com> Date: Tue, 6 Apr 2021 09:57:59 +0100 Subject: [PATCH 6/6] Updates.txt --- Updates.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Updates.txt b/Updates.txt index 52206fe7..11fe04a1 100644 --- a/Updates.txt +++ b/Updates.txt @@ -4,6 +4,7 @@ - Fix: Occasional GW1000 crash on GetSensorIdsNew response timeout - Fix: GW1000, WH40 rain gauge, removed battery status check as it does not send this information - Fix: Adds missing WeatherCloud interval setting to Internet Settings +- Fix: Default web site Monthly NOAA reports before the year 2010 - New: Now determines the Ecowitt GW1000 device main sensor type (WH65/WH24) and prints system information to the log file - New: Adds the free text station model to the Station settings page