mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
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:
@@ -99,6 +99,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
|
||||
</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.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
[assembly: AssemblyCompany("PepperDash Technology Corp")]
|
||||
[assembly: AssemblyProduct("PepperDashEssentials")]
|
||||
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
|
||||
[assembly: AssemblyVersion("1.2.5.*")]
|
||||
[assembly: AssemblyVersion("1.2.6.*")]
|
||||
|
||||
|
||||
@@ -324,6 +324,36 @@ namespace PepperDash.Essentials.Room.Config
|
||||
|
||||
[JsonProperty("timoutMinutes")]
|
||||
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
|
||||
|
||||
@@ -387,7 +387,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// Will power the room on with the last-used source
|
||||
/// </summary>
|
||||
public void PowerOnToDefaultOrLastSource()
|
||||
public override void PowerOnToDefaultOrLastSource()
|
||||
{
|
||||
if (!EnablePowerOnToLastSource || LastSourceKey == null)
|
||||
return;
|
||||
|
||||
@@ -532,7 +532,7 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// Will power the room on with the last-used source
|
||||
/// </summary>
|
||||
public void PowerOnToDefaultOrLastSource()
|
||||
public override void PowerOnToDefaultOrLastSource()
|
||||
{
|
||||
if (!EnablePowerOnToLastSource || LastSourceKey == null)
|
||||
return;
|
||||
|
||||
@@ -61,6 +61,22 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
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>
|
||||
@@ -205,6 +221,11 @@ namespace PepperDash.Essentials
|
||||
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)
|
||||
{
|
||||
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
|
||||
@@ -217,15 +238,27 @@ namespace PepperDash.Essentials
|
||||
{
|
||||
Debug.Console(1, this, "Notice: Occupancy Detected");
|
||||
// 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>
|
||||
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
|
||||
|
||||
Submodule essentials-framework updated: f28c59035c...c9244a5d64
Reference in New Issue
Block a user