-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhilipsHueAction.cs
More file actions
27 lines (26 loc) · 990 Bytes
/
PhilipsHueAction.cs
File metadata and controls
27 lines (26 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Q42.HueApi;
using Q42.HueApi.ColorConverters;
using Q42.HueApi.ColorConverters.HSB;
using Q42.HueApi.Interfaces;
using StreamDeckLib;
using StreamDeckLib.Messages;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace PhilipsHueSdPlugin
{
[ActionUuid(Uuid="com.trilliuminnovations.philipshue.custom")]
public class PhilipsHueAction : BaseStreamDeckActionWithSettingsModel<Models.CustomColorSettingsModel>
{
public override async Task OnKeyUp(StreamDeckEventPayload args)
{
if (SettingsModel.IsValid())
{
ILocalHueClient client = new LocalHueClient(SettingsModel.hueHubIp);
client.Initialize(SettingsModel.appUserId);
var cmd = new LightCommand();
cmd.TurnOn().SetColor(new RGBColor(SettingsModel.colorHex));
await client.SendCommandAsync(cmd, new List<string> { SettingsModel.lightIndex.ToString() });
}
}
}
}