From 56cf54a6443b521c3e3b6be7b26db51eb289a9e1 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 8 Dec 2020 16:24:03 -0700 Subject: [PATCH] Added LinkRooms as a PostActivationAction --- .../Bridges/BridgeBase.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index 443a720e..86db81ba 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -99,12 +99,19 @@ namespace PepperDash.Essentials.Core.Bridges Eisc.SigChange += Eisc_SigChange; AddPostActivationAction(LinkDevices); + AddPostActivationAction(LinkRooms); } private void LinkDevices() { Debug.Console(1, this, "Linking Devices..."); + if (PropertiesConfig.Devices == null) + { + Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No devices linked to this bridge"); + return; + } + foreach (var d in PropertiesConfig.Devices) { var device = DeviceManager.GetDeviceForKey(d.DeviceKey); @@ -152,10 +159,16 @@ namespace PepperDash.Essentials.Core.Bridges Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful"); } - public void LinkToRooms() + public void LinkRooms() { Debug.Console(1, this, "Linking Rooms..."); + if (PropertiesConfig.Rooms == null) + { + Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "No rooms linked to this bridge."); + return; + } + foreach (var room in PropertiesConfig.Rooms) { var rm = DeviceManager.GetDeviceForKey(room.RoomKey) as IBridgeAdvanced;