Skip to content

Commit

Permalink
Merge pull request #117 from mcrossley/master
Browse files Browse the repository at this point in the history
v3.12.1
  • Loading branch information
mcrossley authored Aug 11, 2021
2 parents f55db81 + 6b92008 commit b755814
Show file tree
Hide file tree
Showing 22 changed files with 758 additions and 10,513 deletions.
12 changes: 9 additions & 3 deletions CumulusMX/AlarmSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ public string GetAlarmSettings()
Notify = cumulus.SensorAlarm.Notify,
Email = cumulus.SensorAlarm.Email,
Latches = cumulus.SensorAlarm.Latch,
LatchHrs = cumulus.SensorAlarm.LatchHours
LatchHrs = cumulus.SensorAlarm.LatchHours,
Threshold = cumulus.SensorAlarm.TriggerThreshold
},
dataStopped = new JsonAlarmValues()
{
Expand All @@ -157,7 +158,8 @@ public string GetAlarmSettings()
Notify = cumulus.DataStoppedAlarm.Notify,
Email = cumulus.DataStoppedAlarm.Email,
Latches = cumulus.DataStoppedAlarm.Latch,
LatchHrs = cumulus.DataStoppedAlarm.LatchHours
LatchHrs = cumulus.DataStoppedAlarm.LatchHours,
Threshold = cumulus.DataStoppedAlarm.TriggerThreshold
},
batteryLow = new JsonAlarmValues()
{
Expand All @@ -167,7 +169,8 @@ public string GetAlarmSettings()
Notify = cumulus.BatteryLowAlarm.Notify,
Email = cumulus.BatteryLowAlarm.Email,
Latches = cumulus.BatteryLowAlarm.Latch,
LatchHrs = cumulus.BatteryLowAlarm.LatchHours
LatchHrs = cumulus.BatteryLowAlarm.LatchHours,
Threshold = cumulus.BatteryLowAlarm.TriggerThreshold
},
spike = new JsonAlarmValues()
{
Expand Down Expand Up @@ -363,6 +366,7 @@ public string UpdateAlarmSettings(IHttpContext context)
cumulus.SensorAlarm.Email = settings.contactLost.Email;
cumulus.SensorAlarm.Latch = settings.contactLost.Latches;
cumulus.SensorAlarm.LatchHours = settings.contactLost.LatchHrs;
cumulus.SensorAlarm.TriggerThreshold = settings.contactLost.Threshold;

cumulus.DataStoppedAlarm.Enabled = settings.dataStopped.Enabled;
cumulus.DataStoppedAlarm.Sound = settings.dataStopped.SoundEnabled;
Expand All @@ -371,6 +375,7 @@ public string UpdateAlarmSettings(IHttpContext context)
cumulus.DataStoppedAlarm.Email = settings.dataStopped.Email;
cumulus.DataStoppedAlarm.Latch = settings.dataStopped.Latches;
cumulus.DataStoppedAlarm.LatchHours = settings.dataStopped.LatchHrs;
cumulus.DataStoppedAlarm.TriggerThreshold = settings.dataStopped.Threshold;

cumulus.BatteryLowAlarm.Enabled = settings.batteryLow.Enabled;
cumulus.BatteryLowAlarm.Sound = settings.batteryLow.SoundEnabled;
Expand All @@ -379,6 +384,7 @@ public string UpdateAlarmSettings(IHttpContext context)
cumulus.BatteryLowAlarm.Email = settings.batteryLow.Email;
cumulus.BatteryLowAlarm.Latch = settings.batteryLow.Latches;
cumulus.BatteryLowAlarm.LatchHours = settings.batteryLow.LatchHrs;
cumulus.BatteryLowAlarm.TriggerThreshold = settings.batteryLow.Threshold;

cumulus.SpikeAlarm.Enabled = settings.spike.Enabled;
cumulus.SpikeAlarm.Sound = settings.spike.SoundEnabled;
Expand Down
25 changes: 25 additions & 0 deletions CumulusMX/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public static class Api
internal static HttpStationWund stationWund;
internal static HttpStationEcowitt stationEcowitt;
internal static HttpStationEcowitt stationEcowittExtra;
internal static HttpStationAmbient stationAmbient;
internal static HttpStationAmbient stationAmbientExtra;


private static string EscapeUnicode(string input)
Expand Down Expand Up @@ -1113,6 +1115,29 @@ public async Task<bool> GetStation()
Response.StatusCode = 500;
return await this.StringResponseAsync("HTTP Station (Wunderground) is not running");
}

case "ambient":
if (stationAmbient != null)
{
return await this.StringResponseAsync(stationAmbient.ProcessData(this));
}
else
{
Response.StatusCode = 500;
return await this.StringResponseAsync("HTTP Station (Ambient) is not running");
}

case "ambientextra":
if (stationAmbientExtra != null)
{
return await this.StringResponseAsync(stationAmbient.ProcessExtraData(this));
}
else
{
Response.StatusCode = 500;
return await this.StringResponseAsync("HTTP Station (Ambient) is not running");
}

}

throw new KeyNotFoundException("Key Not Found: " + lastSegment);
Expand Down
Loading

0 comments on commit b755814

Please sign in to comment.