mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
Added LinkRooms as a PostActivationAction
This commit is contained in:
@@ -99,12 +99,19 @@ namespace PepperDash.Essentials.Core.Bridges
|
|||||||
Eisc.SigChange += Eisc_SigChange;
|
Eisc.SigChange += Eisc_SigChange;
|
||||||
|
|
||||||
AddPostActivationAction(LinkDevices);
|
AddPostActivationAction(LinkDevices);
|
||||||
|
AddPostActivationAction(LinkRooms);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LinkDevices()
|
private void LinkDevices()
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Linking Devices...");
|
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)
|
foreach (var d in PropertiesConfig.Devices)
|
||||||
{
|
{
|
||||||
var device = DeviceManager.GetDeviceForKey(d.DeviceKey);
|
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");
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LinkToRooms()
|
public void LinkRooms()
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "Linking Rooms...");
|
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)
|
foreach (var room in PropertiesConfig.Rooms)
|
||||||
{
|
{
|
||||||
var rm = DeviceManager.GetDeviceForKey(room.RoomKey) as IBridgeAdvanced;
|
var rm = DeviceManager.GetDeviceForKey(room.RoomKey) as IBridgeAdvanced;
|
||||||
|
|||||||
Reference in New Issue
Block a user