Skip to content

Commit

Permalink
Merge branch 'release/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ngenovese11 committed Jun 26, 2020
2 parents c1551f8 + 1a04dbe commit f4340cf
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/GenerateVersionNumber.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ switch -regex ($Env:GITHUB_REF) {
$phase = 'rc'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER
}
'^refs\/heads\/development*.' {
'^refs\/heads\/dev*.' {
$phase = 'beta'
$newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER
}
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/ZipBuildOutput.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Get-ChildItem -Path $destination | Where-Object {($_.Extension -eq ".clz") -or (
Get-ChildItem -Recurse -Path "$($Env:GITHUB_WORKSPACE)" -include $filenames | Copy-Item -Destination ($destination) -Force
}
}
Get-ChildItem -Path $destination\*.cplz | Rename-Item -NewName { "$($_.BaseName)-$($Env:VERSION)$($_.Extension)" }
Compress-Archive -Path $destination -DestinationPath "$($Env:GITHUB_WORKSPACE)\$($Env:SOLUTION_FILE)-$($Env:VERSION).zip" -Force
Write-Host "Output Contents post Zip"
Get-ChildItem -Path $destination
26 changes: 14 additions & 12 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ on:
- feature/*
- hotfix/*
- release/*
- development
- dev*

env:
# solution path doesn't need slashes unless there it is multiple folders deep
# solution path needs slashes (use \). When solution file name and path are put together, it should be a valid path
# If Solution is in repo root, leave SOLUTION_PATH empty
# solution name does not include extension. .sln is assumed
SOLUTION_PATH: PDT.LutronQuantum.EPI
SOLUTION_FILE: PDT.LutronQuantum.EPI
Expand All @@ -28,15 +29,9 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
# And any submodules
- name: Checkout submodules
shell: bash
run: |
git config --global url."https://github.com/".insteadOf "[email protected]:"
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
# Fetch all tags
submodules: true
token: ${{ secrets.PLUGIN_ACTION_TOKEN }}
# Fetch all tags
- name: Fetch tags
run: git fetch --tags
# Generate the appropriate version number
Expand All @@ -51,15 +46,22 @@ jobs:
run: |
Write-Output ${{ env.VERSION }}
./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }}
# Login to Docker
- name: Login to Docker
uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# Build the solutions in the docker image
- name: Build Solution
shell: powershell
run: |
Invoke-Expression "docker run --rm --mount type=bind,source=""$($Env:GITHUB_WORKSPACE)"",target=""c:/project"" pepperdash/sspbuilder c:\cihelpers\vsidebuild.exe -Solution ""c:\project\$($Env:SOLUTION_PATH)\$($Env:SOLUTION_FILE).sln"" -BuildSolutionConfiguration $($ENV:BUILD_TYPE)"
Invoke-Expression "docker run --rm --mount type=bind,source=""$($Env:GITHUB_WORKSPACE)"",target=""c:/project"" pepperdash/sspbuilder c:\cihelpers\vsidebuild.exe -Solution ""c:\project\$($Env:SOLUTION_PATH)$($Env:SOLUTION_FILE).sln"" -BuildSolutionConfiguration $($ENV:BUILD_TYPE)"
# Zip up the output files as needed
- name: Zip Build Output
shell: powershell
run: ./.github/scripts/ZipBuildOutput.ps1
# Upload output files
- name: Upload Build Output
uses: actions/upload-artifact@v1
with:
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,10 @@ jobs:
# First we checkout the source repo
- name: Checkout repo
uses: actions/checkout@v2
# And any submodules
- name: Checkout submodules
shell: bash
run: |
git config --global url."https://github.com/".insteadOf "[email protected]:"
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
# Fetch all tags
- name: Fetch tags
run: git fetch --tags
with:
fetch-depth: 0
submodules: true
token: ${{ secrets.PLUGIN_ACTION_TOKEN }}
# Generate the appropriate version number
- name: Set Version Number
shell: powershell
Expand All @@ -47,6 +40,12 @@ jobs:
run: |
Write-Output ${{ env.VERSION }}
./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }}
# Login to Docker
- name: Login to Docker
uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# Build the solutions in the docker image
- name: Build Solution
shell: powershell
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

[submodule "EssentialsBuilds"]
path = EssentialsBuilds
url = https://github.com/PepperDash/Essentials-Builds.git
branch = releases
url = https://github.com/PepperDash-Engineering/essentials-builds.git
2 changes: 1 addition & 1 deletion EssentialsBuilds
71 changes: 65 additions & 6 deletions PDT.LutronQuantum.EPI/LutronQuantum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Lighting;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices;
using PepperDash.Core;
using PepperDash.Essentials.Bridges;
using Crestron.SimplSharpPro.DeviceSupport;

namespace LutronQuantum
{
public class LutronQuantum : LightingBase, ILightingMasterRaiseLower, ICommunicationMonitor, IBridge
public class LutronQuantum : LightingBase, ILightingScenes, ILightingMasterRaiseLower, ICommunicationMonitor, IBridge
{
public static void LoadPlugin()
{
Expand All @@ -33,10 +34,12 @@ public static LutronQuantum BuildDevice(DeviceConfig dc)
Debug.Console(2, "LutronQuantum comm is null: {0}", comm == null);
var config = JsonConvert.DeserializeObject<LutronQuantumConfigObject>(dc.Properties.ToString());

var newMe = new LutronQuantum(dc.Key, dc.Name, comm, config);
var newMe = new LutronQuantum(dc, comm, config);
return newMe;
}

readonly DeviceConfig _config;

public IBasicCommunication Communication { get; private set; }
public CommunicationGather PortGather { get; private set; }
public StatusMonitorBase CommunicationMonitor { get; private set; }
Expand All @@ -53,9 +56,10 @@ public static LutronQuantum BuildDevice(DeviceConfig dc)
const string Set = "#";
const string Get = "?";

public LutronQuantum(string key, string name, IBasicCommunication comm, LutronQuantumConfigObject props)
: base(key, name)
public LutronQuantum(DeviceConfig config, IBasicCommunication comm, LutronQuantumConfigObject props)
: base(config.Key, config.Name)
{
_config = config;
Communication = comm;

IntegrationId = props.IntegrationId;
Expand All @@ -69,7 +73,6 @@ public LutronQuantum(string key, string name, IBasicCommunication comm, LutronQu
Password = props.Control.TcpSshProperties.Password;
}


LightingScenes = props.Scenes;

var socket = comm as ISocketStatus;
Expand Down Expand Up @@ -259,7 +262,58 @@ public void ShadeGroupLower(string ShadeGroupId)
{
SendLine(string.Format("{0}SHADEGRP,{1},{2}", Set, ShadeGroupId, (int)eAction.Lower));
}


public void SetIntegrationId(string id)
{
if (String.IsNullOrEmpty(id))
return;

var props = JsonConvert.DeserializeObject<LutronQuantumConfigObject>(_config.Properties.ToString());

if (props.IntegrationId.Equals(id))
return;

props.IntegrationId = id;
IntegrationId = id;

_config.Properties = JsonConvert.SerializeObject(props);
ConfigWriter.UpdateDeviceConfig(_config);
}

public void SetShadeGroup1Id(string id)
{
if (String.IsNullOrEmpty(id))
return;

var props = JsonConvert.DeserializeObject<LutronQuantumConfigObject>(_config.Properties.ToString());

if (props.ShadeGroup1Id.Equals(id))
return;

props.ShadeGroup1Id = id;
ShadeGroup1Id = id;

_config.Properties = JsonConvert.SerializeObject(props);
ConfigWriter.UpdateDeviceConfig(_config);
}

public void SetShadeGroup2Id(string id)
{
if (String.IsNullOrEmpty(id))
return;

var props = JsonConvert.DeserializeObject<LutronQuantumConfigObject>(_config.Properties.ToString());

if (props.ShadeGroup2Id.Equals(id))
return;

props.ShadeGroup2Id = id;
ShadeGroup2Id = id;

_config.Properties = JsonConvert.SerializeObject(props);
ConfigWriter.UpdateDeviceConfig(_config);
}


/// <summary>
/// Appends the delimiter and sends the string
Expand All @@ -278,6 +332,11 @@ public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey)
}

#endregion

public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, PepperDash.Essentials.Core.Bridges.EiscApiAdvanced bridge)
{
this.LinkToApiExt(trilist, joinStart, joinMapKey);
}
}

public enum eAction : int
Expand Down
19 changes: 11 additions & 8 deletions PDT.LutronQuantum.EPI/LutronQuantumBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,19 @@ public static class LutronQuantumTemplateBridge
public static void LinkToApiExt(this LutronQuantum lightingDevice, BasicTriList trilist, uint joinStart, string joinMapKey)
{
LutronQuantumJoinMap joinMap = new LutronQuantumJoinMap();

var joinMapSerialized = JoinMapHelper.GetJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<LutronQuantumJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);

Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Lighting Type {0}", lightingDevice.GetType().Name.ToString());

trilist.SetStringSigAction(joinMap.IntegrationIdSet, id => lightingDevice.SetIntegrationId(id));
trilist.SetStringSigAction(joinMap.ShadeGroup1IdSet, id => lightingDevice.SetShadeGroup1Id(id));
trilist.SetStringSigAction(joinMap.ShadeGroup2IdSet, id => lightingDevice.SetShadeGroup2Id(id));

// GenericLighitng Actions & FeedBack
trilist.SetUShortSigAction(joinMap.SelectScene, u => lightingDevice.SelectScene(lightingDevice.LightingScenes[u]));
int sceneIndex = 1;
Expand All @@ -43,13 +50,6 @@ public static void LinkToApiExt(this LutronQuantum lightingDevice, BasicTriList
trilist.SetStringSigAction(joinMap.ShadeGroup1IdSet, s => lightingDevice.ShadeGroup1Id = s);
trilist.SetStringSigAction(joinMap.ShadeGroup2IdSet, s => lightingDevice.ShadeGroup2Id = s);

/*
if (lightingDevice.GetType().Name.ToString() == "LutronQuantumArea")
{
var lutronDevice = lightingDevice as PepperDash.Essentials.Devices.Common.Environment.Lutron.LutronQuantumArea;
}
*/
// Shades
trilist.SetSigTrueAction(joinMap.ShadeGroup1Raise, () =>
{
Expand Down Expand Up @@ -104,8 +104,8 @@ public LutronQuantumJoinMap()
IntegrationIdSet = 1;
ShadeGroup1IdSet = 2;
ShadeGroup2IdSet = 3;

}

public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
Expand All @@ -117,6 +117,9 @@ public override void OffsetJoinNumbers(uint joinStart)
ShadeGroup1Lower = ShadeGroup1Lower + joinOffset;
ShadeGroup2Raise = ShadeGroup2Raise + joinOffset;
ShadeGroup2Lower = ShadeGroup2Lower + joinOffset;
IntegrationIdSet = IntegrationIdSet + joinOffset;
ShadeGroup1IdSet = ShadeGroup1IdSet + joinOffset;
ShadeGroup2IdSet = ShadeGroup2IdSet + joinOffset;
}
}
}
Expand Down
Binary file modified PDT.LutronQuantum.EPI/PDT.LutronQuantum.EPI.suo
Binary file not shown.

0 comments on commit f4340cf

Please sign in to comment.