fix: make registering for push schedule updates optional

The default config for a Fusion room will now NOT subscribe for Fusion schedule push updates unless explicitly
requested.
This commit is contained in:
Andrew Welker
2026-02-09 08:09:18 -06:00
parent c0971a4f8e
commit 1fb5d3e5ee
2 changed files with 40 additions and 25 deletions

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
@@ -698,11 +699,19 @@ namespace PepperDash.Essentials.Core.Fusion
/// <param name="args"></param>
protected void FusionRoom_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
if (args.DeviceOnLine)
if (!args.DeviceOnLine)
{
CrestronInvoke.BeginInvoke((o) =>
return;
}
if (!_config.EnableSchedulePushNotifications)
{
CrestronEnvironment.Sleep(200);
return;
}
Task.Run(() =>
{
// CrestronEnvironment.Sleep(200);
// Send Push Notification Action request:
@@ -755,7 +764,6 @@ namespace PepperDash.Essentials.Core.Fusion
_dailyTimeRequestTimer.Reset(86400000, 86400000);
});
}
}
/// <summary>
/// Requests the local date and time from the Fusion Server
@@ -785,7 +793,7 @@ namespace PepperDash.Essentials.Core.Fusion
var requestTest =
string.Format(
"<RequestSchedule><RequestID>FullSchedleRequest</RequestID><RoomID>{0}</RoomID><Start>{1}</Start><HourSpan>24</HourSpan></RequestSchedule>",
"<RequestSchedule><RequestID>FullScheduleRequest</RequestID><RoomID>{0}</RoomID><Start>{1}</Start><HourSpan>24</HourSpan></RequestSchedule>",
RoomGuid, currentTime);
Debug.LogMessage(LogEventLevel.Verbose, this, "Sending Fusion ScheduleQuery: \n{0}", requestTest);
@@ -960,7 +968,7 @@ namespace PepperDash.Essentials.Core.Fusion
select parameter.Attributes
into attributes
where attributes["ID"].Value == "Registered"
select Int32.Parse(attributes["Value"].Value))
select int.Parse(attributes["Value"].Value))
{
switch (isRegistered)
{
@@ -1112,7 +1120,7 @@ namespace PepperDash.Essentials.Core.Fusion
protected void FusionRoomSchedule_DeviceExtenderSigChange(DeviceExtender currentDeviceExtender,
SigEventArgs args)
{
Debug.LogMessage(LogEventLevel.Verbose, this, "Scehdule Response Event: {0}\n Sig: {1}\nFusionResponse:\n{2}", args.Event,
Debug.LogMessage(LogEventLevel.Verbose, this, "Schedule Response Event: {0}\n Sig: {1}\nFusionResponse:\n{2}", args.Event,
args.Sig.Name, args.Sig.StringValue);

View File

@@ -75,4 +75,11 @@ public class IEssentialsRoomFusionControllerPropertiesConfig
/// </summary>
[JsonProperty("helpRequestTimeoutMs")]
public int HelpRequestTimeoutMs { get; set; } = 30000;
/// <summary>
/// Gets or sets whether to enable schedule push notifications
/// </summary>
/// <remarks>Defaults to false to skip getting schedule unless required</remarks>
[JsonProperty("enableSchedulePushNotifications")]
public bool EnableSchedulePushNotifications { get; set; } = false;
}