mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-13 20:47:04 +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:
parent
c839cea495
commit
c0c90f926e
7 changed files with 412 additions and 345 deletions
|
|
@ -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();
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit f28c59035c5de92dc2c957ad2bd56ada4538d0f3
|
||||
Subproject commit c9244a5d64b7ae915cba9536e2ef64f9abba2520
|
||||
Loading…
Add table
Add a link
Reference in a new issue