NetHue 0.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package NetHue --version 0.0.3
NuGet\Install-Package NetHue -Version 0.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetHue" Version="0.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetHue --version 0.0.3
#r "nuget: NetHue, 0.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NetHue as a Cake Addin
#addin nuget:?package=NetHue&version=0.0.3

// Install NetHue as a Cake Tool
#tool nuget:?package=NetHue&version=0.0.3

NetHue

A C# package for managment of Phillips Hue devices.

  • Based off of the Hue Clip API V2
  • Implementation is currently geared towards basic interaction with the API, such as getting lights, updating the colors of lights, setting scenes, etc.
  • Programmatic creation of scenes, rooms, and so on is currently on hold.
    • The Hue App provides a UI for working with these visual functionalities, consider the current state of this project as an "add on" for interacting with the API programmatically.

License

Shield: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

Base Concepts

  • Controllers: Handle fetching information about your Hue ecosystem from the configured HueBridge. A controller will (soon to be) exist for each endpoint in the Hue Clip API V2, allowing for programmatic access to Hue resources.
  • Models: Store the information returned from the API. Some fields are renamed due to what I can tell to be as odd choices of names.
  • Repositories: As a user of the package, there should be no direct interation with the repository(s) defined in this package. Handles basic HTTP calls to a Hue bridge.

Getting Set-Up

Package was designed to be as easy to get started with as possible.

  1. Follow the according steps to find the IP of your HueBridge, and create a client key for access to your Hue Bridge's API - Setup Instructions
  2. Once you have these values, you're almost there! Create a JSON file titled whatever you like, we will call it: config.json. This file will contain the information you just fetched about your Hue bridge in the following schema:
    {
        "ip": "YOUR_BRIDGE_IP",
        "appKey": "YOUR_SECRET_APPKEY"
    }
    
  3. And thats it! Use this created file to create a HueConfiguration object by manually parsing the IP and Application Key, or just use HueConfiguration.FromJson("config.json"). All of the controllers for this package take a HueConfiguration object as a constructor parameter, or you can provide the path to this file and they'll handle the parsing themselves.

Basic Examples

  • Example of getting all the lights connected to your Hue bridge:

    var controller = new HueLightController("config.json");
    var lights = await controller.GetLights();
    
  • Example getting all the lights of a room configured on your Hue bridge:

    var config = new HueConfiguration("config.json");
    var lightController = new HueLightController(config);
    var roomController = new HueRoomController(config);
    
    var room = await roomController.GetRooms().First();
    var lights = await lightController.GetLights(room);
    
  • Example setting a scene:

    var controller = new HueSceneController("config.json");
    var scene = controller.GetScenes().First();
    
    // SetScene mutates passed in scene object, no need to catch it.
    await controller.SetScene(scene);
    
  • Example changing the current brightness of a scene:

    var controller = new HueSceneController("config.json");
    var scene = controller.GetScenes().First();
    
    // Set scene to 50 percent brightness.
    await controller.SetSceneBrightness(scene, 50);
    
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.13 237 11/3/2023
0.0.12 110 9/20/2023
0.0.11 104 9/20/2023
0.0.10 82 9/19/2023
0.0.9 117 9/18/2023
0.0.8 98 9/16/2023
0.0.7 179 9/16/2023
0.0.6 128 9/16/2023
0.0.5 108 9/15/2023
0.0.4 130 9/13/2023
0.0.3 114 9/13/2023
0.0.2 117 9/13/2023
0.0.1 121 9/11/2023