mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
Adds optional enable property to partition sensor config and defaults to enable
This commit is contained in:
@@ -85,18 +85,32 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
if (_partitionSensor.IsOnline == false) return;
|
if (_partitionSensor.IsOnline == false) return;
|
||||||
|
|
||||||
|
// Default to enable
|
||||||
|
_partitionSensor.Enable.BoolValue = true;
|
||||||
|
|
||||||
Debug.Console(1, this, "Attempting to apply settings to sensor from config");
|
Debug.Console(1, this, "Attempting to apply settings to sensor from config");
|
||||||
|
|
||||||
if (PropertiesConfig.Sensitivity != null)
|
if (PropertiesConfig.Sensitivity != null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Sensitivity found, attempting to set value '{0}' from config",
|
Debug.Console(1, this, "Sensitivity found, attempting to set value '{0}' from config",
|
||||||
PropertiesConfig.Sensitivity);
|
PropertiesConfig.Sensitivity);
|
||||||
_partitionSensor.Sensitivity.UShortValue = (ushort) PropertiesConfig.Sensitivity;
|
_partitionSensor.Sensitivity.UShortValue = (ushort)PropertiesConfig.Sensitivity;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Sensitivity null, no value specified in config");
|
Debug.Console(1, this, "Sensitivity null, no value specified in config");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PropertiesConfig.Enable != null)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Enable found, attempting to set value '{0}' from config",
|
||||||
|
PropertiesConfig.Enable);
|
||||||
|
_partitionSensor.Enable.BoolValue = (bool)PropertiesConfig.Enable;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Enable null, no value specified in config");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,5 +17,8 @@ namespace PepperDash_Essentials_Core.PartitionSensor
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
[JsonProperty("sensitivity")]
|
[JsonProperty("sensitivity")]
|
||||||
public ushort? Sensitivity { get; set; }
|
public ushort? Sensitivity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("enable")]
|
||||||
|
public bool? Enable { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user