From 621d8484185e14bc1d9794b48d50e2b89efe557f Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 22 May 2024 14:53:01 -0600 Subject: [PATCH] feat: adds deviceKey property to LevelControlListItem to synthesize device key --- .../Devices/LevelControlListItem.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/PepperDash.Essentials.Core/Devices/LevelControlListItem.cs b/src/PepperDash.Essentials.Core/Devices/LevelControlListItem.cs index bb23e632..d18dacc5 100644 --- a/src/PepperDash.Essentials.Core/Devices/LevelControlListItem.cs +++ b/src/PepperDash.Essentials.Core/Devices/LevelControlListItem.cs @@ -47,6 +47,13 @@ namespace PepperDash.Essentials.Core } } + /// + /// The key of the device in the DeviceManager for control + /// + [JsonProperty("deviceKey")] + public string DeviceKey => DeviceManager.AllDevices. + Where(d => d.Key.Contains(ParentDeviceKey) && d.Key.Contains(ItemKey)).FirstOrDefault()?.Key ?? $"{ParentDeviceKey}--{ItemKey}"; + /// /// Indicates if the item is a level, mute , or both ///