diff --git a/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs b/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs index 2d108e4d..8cd3f30c 100644 --- a/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs +++ b/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.GeneralIO; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -13,6 +14,7 @@ using PepperDash.Essentials.Core.CrestronIO; using PepperDash.Essentials.Devices.Common.DSP; using PepperDash.Essentials.Devices.Common.VideoCodec; +using PepperDash.Essentials.Devices.Common.Occupancy; using PepperDash.Essentials.Devices.Common; @@ -248,6 +250,46 @@ namespace PepperDash.Essentials.Devices.Common return new Roku2(key, name, irCont); } + else if (typeName == "occsensor") + { + var props = JsonConvert.DeserializeObject(properties.ToString()); + uint id = 0x00; + GlsOccupancySensorBase occSensor = null; + + try + { + id = Convert.ToUInt32(props.CresnetId, 8); + } + catch (Exception e) + { + Debug.Console(0, "Unable to convert Crestnet ID: {0} to hex. Error:\n{1}", props.CresnetId, e); + } + + switch (props.Model.ToLower()) + { + case "glsodtccn": + { + occSensor = new GlsOdtCCn(id, Global.ControlSystem); + break; + } + case "glsoirccn": + { + occSensor = new GlsOirCCn(id, Global.ControlSystem); + break; + } + default: + { + Debug.Console(0, "Unrecognized Model: '{0}'. Unable to create occupancy sensor device.", props.Model); + break; + } + } + + if (occSensor != null) + return new EssentialsGlsOccupancySensorBaseController(key, name, occSensor, props); + else + Debug.Console(0, "Unable to create Occupancy Sensor Device. Key: '{0}'", key); + } + return null; } } diff --git a/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs b/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs index e9c73ace..60ea5c63 100644 --- a/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs +++ b/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs @@ -5,6 +5,7 @@ using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro.GeneralIO; +using PepperDash.Core; using PepperDash.Essentials.Core; namespace PepperDash.Essentials.Devices.Common.Occupancy @@ -24,6 +25,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy public class GlsOccupancySensorConfigurationProperties { - + public string CresnetId { get; set; } + public string Model { get; set; } } } \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs b/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs index f6a2b456..08db5f07 100644 --- a/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs +++ b/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs @@ -151,6 +151,8 @@ namespace PepperDash.Essentials.Room.Config } return null; } + + } /// @@ -239,6 +241,7 @@ namespace PepperDash.Essentials.Room.Config public class EssentialsRoomOccSensorConfig { public string DeviceKey { get; set; } + public string TimoutMinutes { get; set; } } public class EssentialsRoomTechConfig diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index af3b4fb0..4b73e9de 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index 8eeb3095..1a2b2536 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ