diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Occupancy/IOccupancyStatusProviderAggregator.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Occupancy/IOccupancyStatusProviderAggregator.cs
index c321dcad..601edf67 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Occupancy/IOccupancyStatusProviderAggregator.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Occupancy/IOccupancyStatusProviderAggregator.cs
@@ -2,17 +2,18 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using Crestron.SimplSharp;
-
+using Crestron.SimplSharp;
+using Crestron.SimplSharpPro.GeneralIO;
using PepperDash.Core;
using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
///
/// Aggregates the RoomIsOccupied feedbacks of one or more IOccupancyStatusProvider objects
///
- public class IOccupancyStatusProviderAggregator : Device, IOccupancyStatusProvider
+ public class IOccupancyStatusProviderAggregator : EssentialsDevice, IOccupancyStatusProvider
{
///
/// Aggregated feedback of all linked IOccupancyStatusProvider devices
@@ -21,16 +22,22 @@ namespace PepperDash.Essentials.Core
{
get
{
- return AggregatedOccupancyStatus.Output;
+ return _aggregatedOccupancyStatus.Output;
}
}
- private BoolFeedbackOr AggregatedOccupancyStatus;
+ private readonly BoolFeedbackOr _aggregatedOccupancyStatus;
public IOccupancyStatusProviderAggregator(string key, string name)
: base(key, name)
{
- AggregatedOccupancyStatus = new BoolFeedbackOr();
+ _aggregatedOccupancyStatus = new BoolFeedbackOr();
+ }
+
+ public IOccupancyStatusProviderAggregator(string key, string name, OccupancyAggregatorConfig config)
+ : this(dc.Key, dc.Name)
+ {
+
}
///
@@ -39,7 +46,30 @@ namespace PepperDash.Essentials.Core
///
public void AddOccupancyStatusProvider(IOccupancyStatusProvider statusProvider)
{
- AggregatedOccupancyStatus.AddOutputIn(statusProvider.RoomIsOccupiedFeedback);
+ _aggregatedOccupancyStatus.AddOutputIn(statusProvider.RoomIsOccupiedFeedback);
+ }
+
+ public void RemoveOccupancyStatusProvider(IOccupancyStatusProvider statusProvider)
+ {
+ _aggregatedOccupancyStatus.RemoveOutputIn(statusProvider.RoomIsOccupiedFeedback);
}
+ }
+
+ public class OccupancyAggregatorFactory : EssentialsDeviceFactory
+ {
+ public OccupancyAggregatorFactory()
+ {
+ TypeNames = new List { "glsodtccn" };
+ }
+
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device");
+
+ var config = dc.Properties.ToObject();
+
+ return new IOccupancyStatusProviderAggregator(dc.Key, dc.Name, config);
+ }
}
}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Occupancy/OccupancyAggregatorConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Occupancy/OccupancyAggregatorConfig.cs
new file mode 100644
index 00000000..7909de04
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Occupancy/OccupancyAggregatorConfig.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core
+{
+ public class OccupancyAggregatorConfig
+ {
+ [JsonProperty("deviceKeys")] public List DeviceKeys { get; set; }
+
+ OccupancyAggregatorConfig()
+ {
+ DeviceKeys = new List();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
index 3919d331..36992629 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
@@ -234,6 +234,7 @@
+