-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55dc459
commit 9e82ce2
Showing
3 changed files
with
88 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Legacy documentation for Q42.HueApi | ||
Q42.HueApi is deprecated. Please use the new HueApi package. | ||
|
||
### Bridge | ||
Before you can communicate with the Philips Hue Bridge, you need to find the bridge and register your application: | ||
|
||
```cs | ||
IBridgeLocator locator = new HttpBridgeLocator(); //Or: LocalNetworkScanBridgeLocator, MdnsBridgeLocator, MUdpBasedBridgeLocator | ||
var bridges = await locator.LocateBridgesAsync(TimeSpan.FromSeconds(5)); | ||
|
||
//Advanced Bridge Discovery options: | ||
bridges = await HueBridgeDiscovery.CompleteDiscoveryAsync(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(30)); | ||
bridges = await HueBridgeDiscovery.FastDiscoveryWithNetworkScanFallbackAsync(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(30)); | ||
bridges = await HueBridgeDiscovery.CompleteDiscoveryAsync(TimeSpan.FromSeconds(5)); | ||
|
||
``` | ||
|
||
Register your application | ||
|
||
```cs | ||
ILocalHueClient client = new LocalHueClient("ip"); | ||
//Make sure the user has pressed the button on the bridge before calling RegisterAsync | ||
//It will throw an LinkButtonNotPressedException if the user did not press the button | ||
var appKey = await client.RegisterAsync("mypersonalappname", "mydevicename"); | ||
//Save the app key for later use | ||
``` | ||
|
||
If you already registered an appname, you can initialize the HueClient with the app's key: | ||
|
||
```cs | ||
client.Initialize("mypersonalappkey"); | ||
``` | ||
|
||
### Control the lights | ||
Main usage of this library is to be able to control your lights. We use a LightCommand for that. A LightCommand can be send to one or more / multiple lights. A LightCommand can hold a color, effect, on/off etc. | ||
|
||
```cs | ||
var command = new LightCommand(); | ||
command.On = true; | ||
``` | ||
|
||
There are some helpers to set a color on a command: | ||
|
||
```cs | ||
//Turn the light on and set a Hex color for the command (see the section about Color Converters) | ||
command.TurnOn().SetColor(new RGBColor("FF00AA")) | ||
``` | ||
|
||
LightCommands also support Effects and Alerts | ||
```cs | ||
//Blink once | ||
command.Alert = Alert.Once; | ||
|
||
//Or start a colorloop | ||
command.Effect = Effect.ColorLoop; | ||
``` | ||
|
||
Once you have composed your command, send it to one or more lights | ||
|
||
```cs | ||
client.SendCommandAsync(command, new List<string> { "1" }); | ||
``` | ||
|
||
Or send it to all lights | ||
|
||
```cs | ||
client.SendCommandAsync(command); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters