{"id":25349280,"url":"https://github.com/ollieday/lifx","last_synced_at":"2025-07-14T04:41:37.604Z","repository":{"id":136238010,"uuid":"93340570","full_name":"OllieDay/Lifx","owner":"OllieDay","description":"Library for controlling LIFX Wi-Fi Smart LED devices","archived":false,"fork":false,"pushed_at":"2024-10-21T23:52:18.000Z","size":95,"stargazers_count":6,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-29T20:02:48.065Z","etag":null,"topics":["csharp","dotnet","iot","library","lifx"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OllieDay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-04T20:48:39.000Z","updated_at":"2024-10-21T23:52:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"d02c1631-801a-446d-886c-f0cf87dc773a","html_url":"https://github.com/OllieDay/Lifx","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/OllieDay/Lifx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OllieDay%2FLifx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OllieDay%2FLifx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OllieDay%2FLifx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OllieDay%2FLifx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OllieDay","download_url":"https://codeload.github.com/OllieDay/Lifx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OllieDay%2FLifx/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265241154,"owners_count":23733188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","iot","library","lifx"],"created_at":"2025-02-14T16:02:24.472Z","updated_at":"2025-07-14T04:41:37.564Z","avatar_url":"https://github.com/OllieDay.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lifx\nLibrary for controlling LIFX Wi-Fi Smart LED devices over the LAN.\n\n## Overview\nThis library allows you to communicate with LIFX devices over the LAN without relying on the LIFX HTTP API.\nAll communication is done over UDP for low-latency device control using the LIFX LAN Protocol.\n\nSee [https://lan.developer.lifx.com/docs](https://lan.developer.lifx.com/docs) for more information about the LIFX LAN\nProtocol.\n\n## Getting started\nInstall the NuGet package into your application.\n\n### Package Manager\n```\nInstall-Package Lifx\n```\n\n### .NET CLI\n```\ndotnet add package Lifx\n```\n\n## Device creation\nThe `LightFactory` class provides functionality for creating `ILight` objects from a given IP address. The `ILight`\nobject contains the IP address, product (i.e. model) and version of the device and is used for all control operations.\n\n```csharp\nvar lightFactory = new LightFactory();\n\nusing (var light = await lightFactory.CreateLightAsync(IPAddress.Parse(\"192.168.0.100\")))\n{\n\t// ...\n}\n```\n\nThe `LightFactory` class has an overloaded constructor that takes an `int` parameter used to specify the port number\nused when communicating with lights. The default port number used with the parameterless constructor is 56700.\n\n```csharp\nvar lightFactory = new LightFactory(1000);\n```\n\n## Device info\nUse the overridden `ToString()` method of the `ILight` object to obtain a string representation of the device.\n\n```csharp\nConsole.WriteLine(light);\n```\n\n### Output\n`[Address: 192.168.0.100; Product: White800HightVoltage; Version: 0]`\n\n## Device state\nUse the `GetStateAsync()` method to retrieve the current state of the device, and the overridden `ToString()` method of\nthe returned `LightState` object to obtain a string representation of the device containing the label, power,\nbrightness, temperature and color.\n\n```csharp\nvar state = await light.GetStateAsync();\n\nConsole.WriteLine(state);\n```\n\n### Output\n`[Label: Office; Power: On; Brightness: 1; Temperature: 3000; Color: [Hue: 0; Saturation: 0]]`\n\n## Device label\nUse the `SetLabelAsync()` method of the `ILight` object to set the device label. A label should consist of no more than\n32 bytes with UTF8 encoding.\n\n```csharp\nawait light.SetLabelAsync(\"Office\");\n```\n\n## Device power\nLight power can be set using `SetPowerAsync(Power)` where the `Power` parameter is an enum with values `Off` and `On`.\n\n```csharp\nawait light.SetPowerAsync(Power.Off);\nawait light.SetPowerAsync(Power.On);\n```\n\nThe methods `OffAsync()` and `OnAsync()` provide the same functionality.\n\n```csharp\nawait light.OffAsync();\nawait light.OnAsync();\n```\n\n## Device brightness\nLight brightness can be set using `SetBrightnessAsync(Percentage)` where the `Percentage` parameter is a `float` between\n0 and 1.\n\n```csharp\nawait light.SetBrightnessAsync(0.5);\n```\n\n## Device temperature\nLight temperature can be set using `SetTemperatureAsync(Temperature)` where the `Temperature` parameter is an `int`\nbetween 1500 and 9000 representing kelvin value. The `Temperature` struct exposes static properties with named\ntemperature values.\n\n```csharp\n// Set temperature to explicit value\nawait light.SetTemperatureAsync(3500);\n\n// Set temperature to named value\nawait light.SetTemperatureAsync(Temperature.Warm);\n```\n\n### Named temperature values\n* `BlueIce`\n* `BlueWater`\n* `BlueOvercast`\n* `BlueDaylight`\n* `CloudyDaylight`\n* `BrightDaylight`\n* `NoonDaylight`\n* `Daylight`\n* `SoftDaylight`\n* `CoolDaylight`\n* `Cool`\n* `Neutral`\n* `NeutralWarm`\n* `Warm`\n* `Incandescent`\n* `UltraWarm`\n\n## Device color\nLight color can be set using `SetColorAsync(Color)` where the `Color` parameter is a struct comprised of hue\n(`int` between 0 and 360) and saturation (`float` between 0 and 1). The `Color` struct exposes static properties with\nnamed color values.\n\n```csharp\n// Set color to explicit value\nawait light.SetColorAsync(new Color(180, 0.5));\n\n// Set color to named value\nawait light.SetColorAsync(Color.Red);\n```\n\n### Named color values\n* `White`\n* `Red`\n* `Orange`\n* `Yellow`\n* `Green`\n* `Cyan`\n* `Blue`\n* `Purple`\n* `Pink`\n\n_Note: this method is only applicable to devices that support color. Calling this method on an unsupported device\nwill result in an `InvalidOperationException` being thrown._\n\n## Device transition duration\nThe following methods of the `ILight` object have overloads that take a `uint` parameter used to specify the duration in\nmilliseconds for the transition.\n\n* `SetPowerAsync(Power)`\n* `OffAsync()`\n* `OnAsync()`\n* `SetBrightnessAsync(Percentage)`\n* `SetTemperatureAsync(Temperature)`\n* `SetColorAsync(Color)`\n\n## Task cancellation\nThe following methods of the `LightFactory` and `ILight` object have overloads that take a `CancellationToken` parameter\nused to cancel a running task.\n\n### LightFactory\n* `CreateLightAsync(IPAddress)`\n\n### ILight\n* `GetStateAsync()`\n* `SetLabelAsync(Label)`\n* `SetPowerAsync(Power)`\n* `OffAsync()`\n* `OnAsync()`\n* `SetBrightnessAsync(Percentage)`\n* `SetTemperatureAsync(Temperature)`\n* `SetColorAsync(Color)`\n\n_Note: all requests will be cancelled if the device does not respond after 5 seconds._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Follieday%2Flifx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Follieday%2Flifx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Follieday%2Flifx/lists"}