mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 20:24:57 +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:
@@ -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;
|
||||
|
||||
@@ -59,7 +59,23 @@ namespace PepperDash.Essentials
|
||||
/// <summary>
|
||||
/// Seconds after vacancy detected until prompt is displayed
|
||||
/// </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>
|
||||
///
|
||||
@@ -203,7 +219,12 @@ namespace PepperDash.Essentials
|
||||
RoomOccupancy = statusProvider;
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -217,16 +238,28 @@ 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//void SwapVolumeDevices(IBasicVolumeControls currentDevice, IBasicVolumeControls newDevice)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user