Updates to add necessary functionality for occupancy sensors to trigger room to power on to default source during specific hours on certain days.

This commit is contained in:
Neil Dorin
2018-08-21 18:23:31 -06:00
parent c839cea495
commit c0c90f926e
7 changed files with 412 additions and 345 deletions

View File

@@ -99,6 +99,10 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath> <HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
</Reference> </Reference>
<Reference Include="SimplSharpTimerEventInterface, Version=1.0.6197.20052, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@@ -4,5 +4,5 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
[assembly: AssemblyVersion("1.2.5.*")] [assembly: AssemblyVersion("1.2.6.*")]

View File

@@ -324,6 +324,36 @@ namespace PepperDash.Essentials.Room.Config
[JsonProperty("timoutMinutes")] [JsonProperty("timoutMinutes")]
public int TimoutMinutes { get; set; } public int TimoutMinutes { get; set; }
[JsonProperty("enableRoomOnWhenOccupied")]
public bool EnableRoomOnWhenOccupied { get; set; }
[JsonProperty("occupancyStartTime")]
public string OccupancyStartTime { get; set; }
[JsonProperty("occupancyEndTime")]
public string OccupancyEndTime { get; set; }
[JsonProperty("enableSunday")]
public bool EnableSunday { get; set; }
[JsonProperty("enableMonday")]
public bool EnableMonday { get; set; }
[JsonProperty("enableTuesday")]
public bool EnableTuesday { get; set; }
[JsonProperty("enableWednesday")]
public bool EnableWednesday { get; set; }
[JsonProperty("enableThursday")]
public bool EnableThursday { get; set; }
[JsonProperty("enableFriday")]
public bool EnableFriday { get; set; }
[JsonProperty("enableSaturday")]
public bool EnableSaturday { get; set; }
} }
public class EssentialsRoomTechConfig public class EssentialsRoomTechConfig

View File

@@ -387,7 +387,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Will power the room on with the last-used source /// Will power the room on with the last-used source
/// </summary> /// </summary>
public void PowerOnToDefaultOrLastSource() public override void PowerOnToDefaultOrLastSource()
{ {
if (!EnablePowerOnToLastSource || LastSourceKey == null) if (!EnablePowerOnToLastSource || LastSourceKey == null)
return; return;

View File

@@ -532,7 +532,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Will power the room on with the last-used source /// Will power the room on with the last-used source
/// </summary> /// </summary>
public void PowerOnToDefaultOrLastSource() public override void PowerOnToDefaultOrLastSource()
{ {
if (!EnablePowerOnToLastSource || LastSourceKey == null) if (!EnablePowerOnToLastSource || LastSourceKey == null)
return; return;

View File

@@ -61,6 +61,22 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
protected int RoomVacancyShutdownPromptSeconds; protected int RoomVacancyShutdownPromptSeconds;
/// <summary>
/// The time of day at which the room occupancy power on feature should be enabled
/// </summary>
protected DateTime RoomOccpuancyPowerOnStart;
/// <summary>
/// The time of day at which the room occupancy power on feature should be disabled
/// </summary>
protected DateTime RoomOccupancyPowerOnEnd;
/// <summary>
/// Should the room power on to the default source if occupied between the start and end times
/// </summary>
protected bool RoomOccupancyPowerOnIsEnabled;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@@ -205,6 +221,11 @@ namespace PepperDash.Essentials
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange; RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
} }
/// <summary>
/// To allow base class to power room on to default source
/// </summary>
public abstract void PowerOnToDefaultOrLastSource();
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e) void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
{ {
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false) if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
@@ -217,15 +238,27 @@ namespace PepperDash.Essentials
{ {
Debug.Console(1, this, "Notice: Occupancy Detected"); Debug.Console(1, this, "Notice: Occupancy Detected");
// Reset the timer when the room is occupied // Reset the timer when the room is occupied
RoomVacancyShutdownTimer.Cancel();
RoomVacancyShutdownTimer.Cancel(); if(RoomOccupancyPowerOnIsEnabled)
{
var currentTime = DateTime.Now.TimeOfDay;
if (currentTime.CompareTo(RoomOccpuancyPowerOnStart.TimeOfDay) > 0 && RoomOccupancyPowerOnEnd.TimeOfDay.CompareTo(currentTime) > 0)
{
PowerOnToDefaultOrLastSource();
}
}
} }
} }
//void SwapVolumeDevices(IBasicVolumeControls currentDevice, IBasicVolumeControls newDevice) /// <summary>
//{ /// Sets up events in the scheduler for the start and end times of the appropriate days to enable and disable the RoomOccupancyPowerOnIsEnabled flag
/// </summary>
void SetUpOccupancyRoomOnEventsInScheduler()
{
//} }
/// <summary> /// <summary>
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed /// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed