Ecs-823 Implement Essentials Light Bridge

WHAR-1441 Add Lutron Temp Bridge
WHAR-1401 Finish testing Lighting Controls
This commit is contained in:
Jason T Alborough
2018-08-27 17:24:53 -04:00
parent daf44ae797
commit 1534433949
3 changed files with 33 additions and 9 deletions

View File

@@ -47,6 +47,11 @@ namespace PepperDash.Essentials {
Debug.Console(2, "Launch essentialstvone");
return new EssentialsTVOne(key, name, properties);
}
else if (typeName == "essentialslighting")
{
Debug.Console(2, "Launch essentialslighting");
return new EssentialsLightsBridge(key, name, properties);
}
return null;
}
}

View File

@@ -31,12 +31,18 @@ namespace PepperDash.Essentials
}
public override bool CustomActivate() {
// Create EiscApis
ICommunicationMonitor comm = null;
try
{
foreach (var device in DeviceManager.AllDevices)
{
if (device.Key == this.Properties.connectionDeviceKey)
{
if (!(device is ICommunicationMonitor))
{
comm = device as ICommunicationMonitor;
}
Debug.Console(2, "deviceKey {0} Matches", device.Key);
Lights = DeviceManager.GetDeviceForKey(device.Key) as PepperDash.Essentials.Core.Lighting.LightingBase;
break;
@@ -51,13 +57,26 @@ namespace PepperDash.Essentials
{
foreach (string Ipid in Properties.EiscApiIpids)
{
var ApiEisc = new BridgeApiEisc(Ipid);
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, TVOneCorio.Name);
Debug.Console(2, "Connecting EiscApi {0} to {1}", ApiEisc.Ipid, Lights.Name);
ushort x = 1;
Lights.Is
var tempDevice = Lights as PepperDash.Core.Device;
tempDevice.
.OnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
if(comm != null)
{
comm.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[ApiMap.Online]);
}
ApiEisc.Eisc.SetUShortSigAction(ApiMap.CallPreset, u => Lights.SelectScene(Lights.LightingScenes[u]));
int sceneIndex = 1;
foreach (var scene in Lights.LightingScenes)
{
var tempIndex = sceneIndex - 1;
ApiEisc.Eisc.SetSigTrueAction((uint)(ApiMap.LightingSceneOffset + sceneIndex), () => Lights.SelectScene(Lights.LightingScenes[tempIndex]));
scene.IsActiveFeedback.LinkInputSig(ApiEisc.Eisc.BooleanInput[(uint)(ApiMap.LightingSceneOffset + sceneIndex)]);
ApiEisc.Eisc.StringInput[(uint)(ApiMap.LightingSceneOffset + sceneIndex)].StringValue = scene.Name;
ApiEisc.Eisc.BooleanInput[(uint)(ApiMap.ButtonVisibilityOffset + sceneIndex)].BoolValue = true;
sceneIndex++;
}
}
}
@@ -85,10 +104,10 @@ namespace PepperDash.Essentials
public class EssentialsLightsBridgeApiMap
{
public ushort CallPreset = 1;
public ushort PresetFeedback = 1;
public ushort Online = 1;
public ushort LightingSceneOffset = 10;
public ushort ButtonVisibilityOffset = 40;
public ushort CallPreset = 1;
public EssentialsLightsBridgeApiMap()
{