Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.02 KB

README.md

File metadata and controls

34 lines (25 loc) · 1.02 KB

HueController

a .Net API for controlling Philips Hue

changelog

Register your Application

    var hue = new HueAPI();
    var user = await hue.Configuration.CreateUserAsync(new CreateUserRequest { DeviceType = "my_hue_Application#Computer1" });

    var userName = user["success"].UserName;
    //Save the above UserName for later user

Control a Group of Lights

In the following example we are going to Turn on all of the lights in the Study over 1 second with full brightness

    //User the Username that was returned from the Register Application
    var hue = new HueAPI(_userName);

    //Get a list of all Groups
    var groups = await hue.Groups.GetAllGroupsAsync();

    //Find a the group named Study
    var studyId = groups.Where(g => g.Value.Name == "Study").Select(g => g.Key).First();

    var builder = new GroupStateBuilder(studyId);
    await builder.TurnOn()
                .WithBrightness(254)
                .WithTransitionTime(10)
                .SendAsync(hueController);