HueApi 3.0.0
dotnet add package HueApi --version 3.0.0
NuGet\Install-Package HueApi -Version 3.0.0
<PackageReference Include="HueApi" Version="3.0.0" />
<PackageVersion Include="HueApi" Version="3.0.0" />
<PackageReference Include="HueApi" />
paket add HueApi --version 3.0.0
#r "nuget: HueApi, 3.0.0"
#:package HueApi@3.0.0
#addin nuget:?package=HueApi&version=3.0.0
#tool nuget:?package=HueApi&version=3.0.0
HueApi
Open source library for communication with the Philips Hue bridge.
Over 400k downloads on NuGet (Q42.Hue + HueApi)
This library covers all the Philips hue API calls! You can set the state of your lights, update the Bridge configuration, create groups, schedules etc.
This library targets .net 8
and .net 9
!
Download directly from NuGet:
- Clip API v2: HueApi on NuGet (works with Hue Bridge Pro!)
New for v3 The new Fluent API allows for easy access to all resources through their respective methods. For example:
//Light resource
localHueApi.Light.GetAllAsync()
localHueApi.Light.UpdateAsync(id, ...)
//Room Resource
localHueApi.Room.GetAllAsync()
Features:
- Support for Hue Entertainment API
- Support for the Hue Remote API
- Support for the Hue Bridge Pro APIs
- Multiple Color Converters
Make sure to install the HueApi packages:
Do not use the Q42
prefixed packages anymore. They target old APIs which will be removed in the future.
How to use?
Some basic usage examples
Use the LocalHueApi:
var localHueApi = new LocalHueApi("BRIDGE_IP", "KEY");
Register your application
//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 regResult = await LocalHueClient.RegisterAsync("BRIDGE_IP", "mypersonalappname", "mydevicename");
//Save the app key for later use and use it to initialize LocalHueApi
var appKey = regResult.Username;
Change the lights:
var lights = await localHueApi.Light.GetAllAsync();
var id = all.Data.Last().Id; //Pick a light
var req = new UpdateLight()
.TurnOn()
.SetColor(new ColorConverters.RGBColor("FF0000"));
var result = await localHueApi.Light.UpdateAsync(id, req);
API Reference
Use the API reference provided by Hue to discover the capabilities of the API. https://developers.meethue.com/develop/hue-api-v2/api-reference/
EventStream
Listen to the new EventStream to get notified by the Hue Bridge when new events occur.
localHueApi.OnEventStreamMessage += EventStreamMessage;
localHueApi.StartEventStream();
void EventStreamMessage(List<EventStreamResponse> events)
{
Console.WriteLine($"{events.Count} new events");
foreach(var hueEvent in events)
{
foreach(var data in hueEvent.Data)
{
Console.WriteLine($"Data: {data.Metadata?.Name} / {data.IdV1}");
}
}
}
//localHueApi.StopEventStream();
Sample usage can be found in the included Console Sample App: HueApi.ConsoleSample
Clip V2 API
Philips Hue has developed a new Clip V2 API. This library has support for the new Clip V2 APIs. Philips Hue is still developing these APIs and new functionality is added regularly. Please create an issue or PR if you need something that is not supported yet.
Support for Hue Entertainment.
Check out the HueApi.Entertainment documentation
Read about the Philips Entertainment API
Remote API
There is also a Philips Hue Remote API. It allows you to send commands to a bridge over the internet. You can request access here: http://www.developers.meethue.com/content/remote-api
Q42.HueApi is compatible with the remote API. There's a sample app and documentation can be found here:
https://github.com/michielpost/Q42.HueApi/blob/master/RemoteApi.md
For remote usage with the new CLIP v2 API, use the new RemoteHueApi("KEY", "token")
Color Conversion
The Philips Hue lights work with Brightness, Saturation, Hue and X, Y properties. More info can be found in the Philips Hue Developer documentation: http://www.developers.meethue.com/documentation/core-concepts#color_gets_more_complicated It's not trivial to convert the light colors to a color system developers like to work with, like RGB or HEX. HueApi has 2 different color converters out of the box. They are in a seperate package and it's easy to create your own color converter.
The HueApi.ColorConverters
NuGet package contains:
- Original: The original converter based on a large XY array.
- HSB: Converts based on Hue, Brightness and Saturation.
How to use a color converter?
Add one of the following usings:
using HueApi.ColorConverters.Original
using HueApi.ColorConverters.HSB
This will add extension methods to Light
, State
and LightCommand
. So you can set the color using new RGBColor()
and convert the State
back to RGBColor
Pull Requests with improvements to the color conversion are always welcome!
How To install?
Download the source from GitHub or get the compiled assembly from NuGet
Credits
This library is made possible by contributions from:
- Michiel Post (@michielpostnl) - core contributor
- Q42 (@q42)
- @ermau
- @koenvanderlinden
- @Indigo744
- and others
License
HueApi is licensed under MIT. Refer to license.txt for more information.
Contributions
Contributions are welcome. Fork this repository and send a pull request if you have something useful to add.
Related Projects
Apps that use Q42.HueAPI
Are you using Q42.HueAPI? Get your app listed here! Edit this page and send a pull request.
Open Source
Windows
Other
No longer available or maintained
- My Hue Light Switch
- CastleOS
- My Hue Light Switch (WP)
- iControlHue (WP)
- OnHue (WP)
- Huetro for Hue (WP)
- hueReact (Android)
- Command Line Tools -- Control your Hue from your command line
- C# Script Command Line Tool -- Use C# as your scripting language
- Andriks.HueApiDemo (Winforms)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on HueApi:
Package | Downloads |
---|---|
HueApi.ColorConverters
For Clip v2 API. Open source library for interaction with the Philips Hue Bridge. Allows you to control your lights from C#. |
|
HueApi.Entertainment
For Clip v2 API. Open source library for interaction with the Philips Hue Bridge. Allows you to control your lights from C#. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
3.0.0 | 0 | 9/22/2025 |
2.1.0 | 298 | 9/18/2025 |
2.0.0 | 476 | 9/9/2025 |
1.9.0 | 1,753 | 6/4/2025 |
1.8.0 | 2,114 | 2/12/2025 |
1.7.0 | 4,130 | 11/19/2024 |
1.6.3 | 1,896 | 7/8/2024 |
1.6.2 | 2,344 | 3/23/2024 |
1.6.1 | 206 | 3/21/2024 |
1.6.0 | 2,615 | 12/14/2023 |
1.5.3 | 204 | 12/14/2023 |
1.5.2 | 248 | 12/11/2023 |
1.5.1 | 604 | 11/23/2023 |
1.5.0 | 552 | 11/15/2023 |
1.4.0 | 1,718 | 8/30/2023 |
1.3.0 | 695 | 8/6/2023 |
1.2.0 | 896 | 6/26/2023 |
1.1.0 | 369 | 6/22/2023 |
1.0.1 | 654 | 5/28/2023 |
1.0.0 | 2,545 | 2/3/2023 |
0.11.0 | 395 | 2/3/2023 |
0.10.0 | 466 | 1/25/2023 |
0.9.10 | 482 | 1/15/2023 |
0.9.9 | 406 | 1/13/2023 |
0.9.8 | 423 | 1/12/2023 |
0.9.7 | 568 | 12/7/2022 |
0.9.6 | 535 | 11/14/2022 |
0.9.5 | 614 | 11/8/2022 |
0.9.4 | 580 | 10/19/2022 |
0.9.3 | 496 | 10/18/2022 |
0.9.2 | 533 | 10/5/2022 |
0.9.1 | 531 | 9/30/2022 |
0.9.0 | 668 | 9/8/2022 |
0.8.0 | 925 | 6/7/2022 |
0.7.42 | 633 | 5/9/2022 |
0.6.42 | 711 | 4/19/2022 |
0.5.42 | 891 | 3/24/2022 |
0.4.42 | 827 | 3/15/2022 |
0.3.42 | 807 | 3/15/2022 |
0.2.42 | 658 | 1/31/2022 |
0.1.42 | 825 | 1/21/2022 |
0.0.42 | 743 | 1/10/2022 |