Added console command to print occupancy sensor settings in console.

This commit is contained in:
jkdevito
2021-02-01 08:24:54 -06:00
parent 5a2070de3f
commit c6cfecdbbb
3 changed files with 1196 additions and 1074 deletions

View File

@@ -120,13 +120,13 @@ namespace PepperDash.Essentials.Core
OccSensor.CenOccupancySensorChange += new GenericEventHandler(OccSensor_CenOccupancySensorChange); OccSensor.CenOccupancySensorChange += new GenericEventHandler(OccSensor_CenOccupancySensorChange);
CrestronConsole.AddNewConsoleCommand(GetSettings,
"occsensorstatus",
"Reports current occupancy sensor settings. Requires a device key.",
ConsoleAccessLevelEnum.AccessOperator);
} }
/// <summary> /// <summary>
/// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs. /// Catches events for feedbacks on the base class. Any extending wrapper class should call this delegate after it checks for it's own event IDs.
/// </summary> /// </summary>
@@ -432,6 +432,47 @@ namespace PepperDash.Essentials.Core
} }
} }
private static void GetSettings(string key)
{
var dev = DeviceManager.GetDeviceForKey(key);
if (dev == null) return;
var sensor = dev as CenOdtOccupancySensorBaseController;
if (sensor == null) return;
if (!sensor.Hardware.IsOnline)
{
Debug.Console(0, sensor.Key, "Sensor IsOnline: {0}", sensor.Hardware.IsOnline);
return;
}
var dash = new string('*', 50);
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
Debug.Console(0, sensor.Key, "Timeout Current: {0} | Remote: {1}",
sensor.CurrentTimeoutFeedback.UShortValue,
sensor.RemoteTimeoutFeedback.UShortValue);
Debug.Console(0, sensor.Key, "Short Timeout Enabled: {0}",
sensor.ShortTimeoutEnabledFeedback.BoolValue);
Debug.Console(0, sensor.Key, "PIR Sensor Enabled: {0} | Sensitivity Occupied: {1} | Sensitivity Vacant: {2}",
sensor.PirSensorEnabledFeedback.BoolValue,
sensor.PirSensitivityInOccupiedStateFeedback.UShortValue,
sensor.PirSensitivityInVacantStateFeedback.UShortValue);
Debug.Console(0, sensor.Key, "Ultrasonic Enabled A: {0} | B: {1}",
sensor.UltrasonicAEnabledFeedback.BoolValue,
sensor.UltrasonicBEnabledFeedback.BoolValue);
Debug.Console(0, sensor.Key, "Ultrasonic Sensitivity Occupied: {0} | Vacant: {1}",
sensor.UltrasonicSensitivityInOccupiedStateFeedback.UShortValue,
sensor.UltrasonicSensitivityInVacantStateFeedback.UShortValue);
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);

View File

@@ -70,9 +70,14 @@ namespace PepperDash.Essentials.Core
RegisterGlsOdtSensorBaseController(OccSensor); RegisterGlsOdtSensorBaseController(OccSensor);
}); });
CrestronConsole.AddNewConsoleCommand(GetSettings,
"occsensorstatus",
"Reports current occupancy sensor settings. Requires a device key.",
ConsoleAccessLevelEnum.AccessOperator);
} }
public GlsOccupancySensorBaseController(string key, string name) : base(key, name) {} public GlsOccupancySensorBaseController(string key, string name) : base(key, name) { }
protected void RegisterGlsOdtSensorBaseController(GlsOccupancySensorBase occSensor) protected void RegisterGlsOdtSensorBaseController(GlsOccupancySensorBase occSensor)
{ {
@@ -293,7 +298,37 @@ namespace PepperDash.Essentials.Core
OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value; OccSensor.ExternalPhotoSensorMinimumChange.UShortValue = value;
} }
private static void GetSettings(string key)
{
var dev = DeviceManager.GetDeviceForKey(key);
if (dev == null) return;
var sensor = dev as GlsOccupancySensorBaseController;
if (sensor == null) return;
if (!sensor.Hardware.IsOnline)
{
Debug.Console(0, sensor.Key, "Sensor IsOnline: {0}", sensor.Hardware.IsOnline);
return;
}
var dash = new string('*', 50);
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
Debug.Console(0, sensor.Key, "Timeout Current: {0} | Local: {1}",
sensor.CurrentTimeoutFeedback.UShortValue,
sensor.LocalTimoutFeedback.UShortValue);
Debug.Console(0, sensor.Key, "Short Timeout Enabled: {0}",
sensor.ShortTimeoutEnabledFeedback.BoolValue);
Debug.Console(0, sensor.Key, "PIR Sensor Enabled: {0} | Sensitivity Occupied: {1} | Sensitivity Vacant: {2}",
sensor.PirSensorEnabledFeedback.BoolValue,
sensor.PirSensitivityInOccupiedStateFeedback.UShortValue,
sensor.PirSensitivityInVacantStateFeedback.UShortValue);
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
}
protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist, protected void LinkOccSensorToApi(GlsOccupancySensorBaseController occController, BasicTriList trilist,
uint joinStart, string joinMapKey, EiscApiAdvanced bridge) uint joinStart, string joinMapKey, EiscApiAdvanced bridge)

View File

@@ -64,6 +64,11 @@ namespace PepperDash.Essentials.Core
UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue); UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue);
}); });
CrestronConsole.AddNewConsoleCommand(GetSettings,
"occsensorstatus",
"Reports current occupancy sensor settings. Requires a device key.",
ConsoleAccessLevelEnum.AccessOperator);
} }
/// <summary> /// <summary>
@@ -170,6 +175,47 @@ namespace PepperDash.Essentials.Core
LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge);
} }
private static void GetSettings(string key)
{
var dev = DeviceManager.GetDeviceForKey(key);
if (dev == null) return;
var sensor = dev as GlsOdtOccupancySensorController;
if (sensor == null) return;
if (!sensor.Hardware.IsOnline)
{
Debug.Console(0, sensor.Key, "Sensor IsOnline: {0}", sensor.Hardware.IsOnline);
return;
}
var dash = new string('*', 50);
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
Debug.Console(0, sensor.Key, "Timeout Current: {0} | Local: {1}",
sensor.CurrentTimeoutFeedback.UShortValue,
sensor.LocalTimoutFeedback.UShortValue);
Debug.Console(0, sensor.Key, "Short Timeout Enabled: {0}",
sensor.ShortTimeoutEnabledFeedback.BoolValue);
Debug.Console(0, sensor.Key, "PIR Sensor Enabled: {0} | Sensitivity Occupied: {1} | Sensitivity Vacant: {2}",
sensor.PirSensorEnabledFeedback.BoolValue,
sensor.PirSensitivityInOccupiedStateFeedback.UShortValue,
sensor.PirSensitivityInVacantStateFeedback.UShortValue);
Debug.Console(0, sensor.Key, "Ultrasonic Enabled A: {0} | B: {1}",
sensor.UltrasonicAEnabledFeedback.BoolValue,
sensor.UltrasonicBEnabledFeedback.BoolValue);
Debug.Console(0, sensor.Key, "Ultrasonic Sensitivity Occupied: {0} | Vacant: {1}",
sensor.UltrasonicSensitivityInOccupiedStateFeedback.UShortValue,
sensor.UltrasonicSensitivityInVacantStateFeedback.UShortValue);
CrestronConsole.PrintLine(string.Format("{0}\n", dash));
}
#region PreActivation #region PreActivation
private static GlsOdtCCn GetGlsOdtCCn(DeviceConfig dc) private static GlsOdtCCn GetGlsOdtCCn(DeviceConfig dc)