Skip to content

Commit

Permalink
Merge pull request #13 from michielpost/feature/HueApiV2
Browse files Browse the repository at this point in the history
HueApi v2 support
  • Loading branch information
michielpost authored Feb 20, 2023
2 parents 5a192b2 + c803c48 commit 166f2d9
Show file tree
Hide file tree
Showing 96 changed files with 1,162 additions and 746 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/docker-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Docker - GitHub Registry

on:
push:
branches:
- master
tags:
- '*'
paths-ignore:
- '**.md'

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: checkout code
uses: actions/checkout@v3

# this is a little bit of "dark magick"...
# Github Registry seems to hate Usernames Containing UpperCase...
#
# this metadata action normalizes the image tags into something useable.
# I'm not sure it's the _best_ set of Docker Tags to use.
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}${{ env.TAG }}
tags: |
type=raw,value=1.0.${{ github.run_number }},priority=1000
type=ref,event=branch
type=sha
type=raw,value=latest
- name: Log in to ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- if: startsWith(github.ref, 'refs/heads/master')
run: echo "TAG=latest" >> $GITHUB_ENV

- if: startsWith(github.ref, 'refs/tags')
run: echo "TAG=$(git describe --tags)" >> $GITHUB_ENV

- name: Build & Push
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
images: michielpost/huelightdj

- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand Down
4 changes: 2 additions & 2 deletions HueLightDJ.Effects/Base/HueEffectAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class HueEffectAttribute : Attribute

public int Order { get; set; } = 100;

public string Name { get; set; }
public required string Name { get; set; }
public string Group { get; set; } = "Other";

/// <summary>
Expand All @@ -19,6 +19,6 @@ public class HueEffectAttribute : Attribute

public bool HasColorPicker { get; set; } = true;

public string DefaultColor { get; set; }
public string? DefaultColor { get; set; }
}
}
4 changes: 2 additions & 2 deletions HueLightDJ.Effects/Base/IHueEffect.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Models;
using System;
using System.Threading;
using System.Threading.Tasks;
Expand Down
6 changes: 3 additions & 3 deletions HueLightDJ.Effects/Base/IHueGroupEffect.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Threading;
Expand Down
4 changes: 2 additions & 2 deletions HueLightDJ.Effects/Base/IHueTouchEffect.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Models;
using System;
using System.Threading;
using System.Threading.Tasks;
Expand Down
4 changes: 2 additions & 2 deletions HueLightDJ.Effects/EffectSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Q42.HueApi.Models.Groups;
using HueApi.Models;
using System;
using System.Collections.Generic;
using System.Text;
Expand All @@ -7,7 +7,7 @@ namespace HueLightDJ.Effects
{
public static class EffectSettings
{
public static LightLocation LocationCenter { get; set; } = new LightLocation() { 0, 0, 0 };
public static HuePosition LocationCenter { get; set; } = new HuePosition();

}
}
8 changes: 4 additions & 4 deletions HueLightDJ.Effects/Group/FlashFadeEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
8 changes: 4 additions & 4 deletions HueLightDJ.Effects/Group/QuickFlashEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
8 changes: 4 additions & 4 deletions HueLightDJ.Effects/Group/RandomColorloopEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
8 changes: 4 additions & 4 deletions HueLightDJ.Effects/Group/RandomColorsEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
8 changes: 4 additions & 4 deletions HueLightDJ.Effects/Group/TrailingLightEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
8 changes: 4 additions & 4 deletions HueLightDJ.Effects/HueLightDJ.Effects.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<WarningsAsErrors>CS8600;CS8601;CS8602;CS8603;CS8625;CS8613</WarningsAsErrors>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Q42.HueApi" Version="3.21.0" />
<PackageReference Include="Q42.HueApi.ColorConverters" Version="3.20.1" />
<PackageReference Include="Q42.HueApi.Entertainment" Version="3.20.1" />
<PackageReference Include="HueApi" Version="1.0.0" />
<PackageReference Include="HueApi.ColorConverters" Version="1.0.0" />
<PackageReference Include="HueApi.Entertainment" Version="1.4.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions HueLightDJ.Effects/Layers/DemoEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using System.Threading;
using System.Threading.Tasks;
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Models;

namespace HueLightDJ.Effects.Layers
{
Expand Down
8 changes: 4 additions & 4 deletions HueLightDJ.Effects/Layers/Flashing/QuickFlashAllEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Text;
Expand Down
8 changes: 4 additions & 4 deletions HueLightDJ.Effects/Layers/Flashing/QuickFlashEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
8 changes: 4 additions & 4 deletions HueLightDJ.Effects/Layers/Flashing/QuickFlashRandomEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down
10 changes: 5 additions & 5 deletions HueLightDJ.Effects/Layers/Party/ColorloopWheelDoubleEffect.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Effects.BasEffects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Effects.BasEffects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down
12 changes: 6 additions & 6 deletions HueLightDJ.Effects/Layers/Party/RainbowBottomTopEffect.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.ColorConverters.HSB;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Effects.BasEffects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.ColorConverters.HSB;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Effects.BasEffects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down
12 changes: 6 additions & 6 deletions HueLightDJ.Effects/Layers/Party/RandomBottomTopEffect.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.ColorConverters.HSB;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Effects.BasEffects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.ColorConverters.HSB;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Effects.BasEffects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down
8 changes: 4 additions & 4 deletions HueLightDJ.Effects/Layers/Party/RandomColorsEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Text;
Expand Down
10 changes: 5 additions & 5 deletions HueLightDJ.Effects/Layers/Party/RandomPulseEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Text;
Expand All @@ -19,7 +19,7 @@ public Task Start(EntertainmentLayer layer, Func<TimeSpan> waitTime, RGBColor? c
Func<TimeSpan> customWaitTime = () => waitTime() / 10;
var center = EffectSettings.LocationCenter;

var randomPulseEffect = new Q42.HueApi.Streaming.Effects.RandomPulseEffect(fadeToZero: false, waitTime: customWaitTime);
var randomPulseEffect = new HueApi.Entertainment.Effects.Examples.RandomPulseEffect(fadeToZero: false, waitTime: customWaitTime);
randomPulseEffect.X = center.X;
randomPulseEffect.Y = center.Y;
layer.PlaceEffect(randomPulseEffect);
Expand Down
10 changes: 5 additions & 5 deletions HueLightDJ.Effects/Layers/Party/RandomPulseRetraceEffect.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using HueLightDJ.Effects.Base;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.Streaming.Effects;
using Q42.HueApi.Streaming.Extensions;
using Q42.HueApi.Streaming.Models;
using HueApi.ColorConverters;
using HueApi.Entertainment.Effects;
using HueApi.Entertainment.Extensions;
using HueApi.Entertainment.Models;
using System;
using System.Collections.Generic;
using System.Text;
Expand All @@ -19,7 +19,7 @@ public Task Start(EntertainmentLayer layer, Func<TimeSpan> waitTime, RGBColor? c
Func<TimeSpan> customWaitTime = () => waitTime() / 10;

var center = EffectSettings.LocationCenter;
var randomPulseEffect = new Q42.HueApi.Streaming.Effects.RandomPulseEffect(waitTime: customWaitTime);
var randomPulseEffect = new HueApi.Entertainment.Effects.Examples.RandomPulseEffect(waitTime: customWaitTime);
randomPulseEffect.X = center.X;
randomPulseEffect.Y = center.Y;
layer.PlaceEffect(randomPulseEffect);
Expand Down
Loading

0 comments on commit 166f2d9

Please sign in to comment.