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
{
private CenRfgwController _gateway;
private GatewayBase _gatewayBase;
private Hr1x0WirelessRemoteBase _remote;
@@ -43,27 +44,31 @@ namespace PepperDash.Essentials.Core
var rfId = (uint)props.Control.InfinetIdInt;
_config = config;
GatewayBase gateway;
if (props.GatewayDeviceKey == "processor")
{
gateway = Global.ControlSystem.ControllerRFGatewayDevice;
{
AddPreActivationAction(() =>
{
_remote = preActivationFunc(config);
RegisterEvents();
});
return;
}
}
else
var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController;
if (gatewayDev == null)
{
var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController;
if (gatewayDev == null)
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid device", props.GatewayDeviceKey);
}
if (gatewayDev != null)
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey);
gateway = gatewayDev.GateWay;
_gateway = gatewayDev;
}
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid device", props.GatewayDeviceKey);
}
if (gatewayDev != null)
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey);
_gateway = gatewayDev;
}
if (_gateway == null) return;