Compare commits

..

4 Commits

Author SHA1 Message Date
Neil Dorin
f0ae0094dc Adds optional enable property to partition sensor config and defaults to enable 2023-07-19 09:50:48 -06:00
Trevor Payne
fcd4b5d772 Merge pull request #1118 from PepperDash/hotfix/AirMediaRegistration
Fix Airmedia Registration Issue
2023-07-12 12:52:56 -05:00
Trevor Payne
c3ba6d5c28 fix: fix issue where the customactivate for the base class was beig suppressed in airmedia controllers 2023-07-12 12:27:38 -05:00
Andrew Welker
acd3bad1f2 Merge pull request #1108 from PepperDash/release/1.14.0
1.14.0
2023-06-07 09:54:34 -06:00
5 changed files with 30 additions and 66 deletions

View File

@@ -3,7 +3,6 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Newtonsoft.Json;
@@ -39,53 +38,6 @@ namespace PepperDash.Essentials.Core
}
}
private const string ParamsPattern = @"(?<=\[).*?(?=])";
private const string DevKeySpacePattern = @"(?<=\().*?(?=\))";
private const string MethodStringPattern = @"(?<=\)\s).*?(?=\s)";
private static readonly Regex ParamsRegex = new Regex(ParamsPattern);
private static readonly Regex DevKeySpaceRegex = new Regex(DevKeySpacePattern);
private static readonly Regex MethodStringRegex = new Regex(MethodStringPattern);
public static void BuildJsonForDeviceAction(string cmd)
{
if (String.IsNullOrEmpty(cmd))
{
CrestronConsole.ConsoleCommandResponse(
"Please provide some data matching the format '<deviceKey> <methodName> [parameters]' The parameters support strings, numbers, and booleans, and are optional. If your device key has spaces in it, wrap it in parenthesis");
}
try
{
var paramsMatch = ParamsRegex.Match(cmd);
var devKeySpaceMatch = DevKeySpaceRegex.Match(cmd);
var methodStringMatch = MethodStringRegex.Match(cmd);
var deviceString = devKeySpaceMatch.Value ?? string.Empty;
var methodString = methodStringMatch.Value ?? string.Empty;
var cmdParts = cmd.Split(' ');
if (cmdParts.Length <= 1)
{
CrestronConsole.ConsoleCommandResponse("Malformed 'deveasy' command - not enough arguments");
return;
}
deviceString = String.IsNullOrEmpty(deviceString) ? cmdParts[0] : deviceString;
methodString = String.IsNullOrEmpty(methodString) ? cmdParts[1] : methodString;
var action = new DeviceActionWrapper()
{
DeviceKey = deviceString,
MethodName = methodString,
Params = (paramsMatch != null) ? new object[] { paramsMatch.Value } : new object[] { }
};
DoDeviceAction(action);
}
catch (Exception ex)
{
CrestronConsole.ConsoleCommandResponse("Malformed 'deveasy' command - consult command help.");
}
}
/// <summary>

View File

@@ -39,13 +39,8 @@ namespace PepperDash.Essentials.Core
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(ListDevices, "devlist", "Lists current managed devices",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(DeviceJsonApi.BuildJsonForDeviceAction, "deveasy",
"Easier way to build devjson commands",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(DeviceJsonApi.DoDeviceActionWithJson, "devjson", "",
ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetProperties(s)), "devprops", "", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetMethods(s)), "devmethods", "", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s)), "apimethods", "", ConsoleAccessLevelEnum.AccessOperator);

View File

@@ -85,18 +85,32 @@ namespace PepperDash.Essentials.Core
{
if (_partitionSensor.IsOnline == false) return;
Debug.Console(1, this, "Attempting to apply settings to sensor from config");
// Default to enable
_partitionSensor.Enable.BoolValue = true;
if (PropertiesConfig.Sensitivity != null)
{
Debug.Console(1, this, "Sensitivity found, attempting to set value '{0}' from config",
PropertiesConfig.Sensitivity);
_partitionSensor.Sensitivity.UShortValue = (ushort) PropertiesConfig.Sensitivity;
}
else
{
Debug.Console(1, this, "Sensitivity null, no value specified in config");
}
Debug.Console(1, this, "Attempting to apply settings to sensor from config");
if (PropertiesConfig.Sensitivity != null)
{
Debug.Console(1, this, "Sensitivity found, attempting to set value '{0}' from config",
PropertiesConfig.Sensitivity);
_partitionSensor.Sensitivity.UShortValue = (ushort)PropertiesConfig.Sensitivity;
}
else
{
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");
}
}

View File

@@ -16,6 +16,9 @@ namespace PepperDash_Essentials_Core.PartitionSensor
/// The sensitivity range shall be between 1(lowest) to 10 (highest).
/// </remarks>
[JsonProperty("sensitivity")]
public ushort? Sensitivity { get; set; }
public ushort? Sensitivity { get; set; }
[JsonProperty("enable")]
public bool? Enable { get; set; }
}
}

View File

@@ -129,7 +129,7 @@ namespace PepperDash.Essentials.DM.AirMedia
else
AirMedia.DisplayControl.DisableAutomaticRouting();
return true;
return base.CustomActivate();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)