Merge pull request #321 from PepperDash/bugfix/RemotePreactivation

Fixed issue where a remote would not run its preactivation action …
This commit is contained in:
Andrew Welker
2020-07-09 21:28:59 -07:00
committed by GitHub

View File

@@ -22,6 +22,7 @@ namespace PepperDash.Essentials.Core
public class Hrxx0WirelessRemoteController : EssentialsBridgeableDevice, IHasFeedback public class Hrxx0WirelessRemoteController : EssentialsBridgeableDevice, IHasFeedback
{ {
private CenRfgwController _gateway; private CenRfgwController _gateway;
private GatewayBase _gatewayBase;
private Hr1x0WirelessRemoteBase _remote; private Hr1x0WirelessRemoteBase _remote;
@@ -43,15 +44,20 @@ namespace PepperDash.Essentials.Core
var rfId = (uint)props.Control.InfinetIdInt; var rfId = (uint)props.Control.InfinetIdInt;
_config = config; _config = config;
GatewayBase gateway;
if (props.GatewayDeviceKey == "processor") if (props.GatewayDeviceKey == "processor")
{ {
gateway = Global.ControlSystem.ControllerRFGatewayDevice; {
AddPreActivationAction(() =>
{
_remote = preActivationFunc(config);
RegisterEvents();
});
return;
}
} }
else
{
var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController; var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController;
if (gatewayDev == null) if (gatewayDev == null)
{ {
@@ -60,10 +66,9 @@ namespace PepperDash.Essentials.Core
if (gatewayDev != null) if (gatewayDev != null)
{ {
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey); Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey);
gateway = gatewayDev.GateWay;
_gateway = gatewayDev; _gateway = gatewayDev;
} }
}
if (_gateway == null) return; if (_gateway == null) return;