WLED 2.0.65

dotnet add package WLED --version 2.0.65
                    
NuGet\Install-Package WLED -Version 2.0.65
                    
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="WLED" Version="2.0.65" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WLED" Version="2.0.65" />
                    
Directory.Packages.props
<PackageReference Include="WLED" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WLED --version 2.0.65
                    
#r "nuget: WLED, 2.0.65"
                    
#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.
#:package WLED@2.0.65
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WLED&version=2.0.65
                    
Install as a Cake Addin
#tool nuget:?package=WLED&version=2.0.65
                    
Install as a Cake Tool

WLED.NET Continuous Integration Workflow install from nuget downloads

A .NET wrapper around the WLED JSON API.

WLED.NET aims to be hard to misuse: state is modelled with strong types and fluent builders so that, wherever possible, an invalid request simply won't compile.

Supported frameworks

The library multi-targets net8.0, net9.0, net10.0 and netstandard2.0.

Getting Started

Installing Package

WLED.NET can be installed via the dotnet CLI:

dotnet add package WLED

For dependency-injection / IHttpClientFactory integration, also install:

dotnet add package WLED.DependencyInjection

Usage

Connecting

var client = new WLedClient("http://office-computer-wled/");

Or register it with dependency injection so the underlying HttpClient is pooled correctly:

services.AddWledClient("http://office-computer-wled/");
// or
services.AddWledClient(client => client.BaseAddress = new Uri("http://office-computer-wled/"));

The WLedClient(string) constructor owns its HttpClient and uses a SocketsHttpHandler with a bounded PooledConnectionLifetime, so a long-lived client still picks up DNS changes (e.g. a WLED device that gets a new IP). For applications, registering via IHttpClientFactory/DI as above remains the recommended approach.

Quick commands

Common operations have first-class "intent" methods:

await client.TurnOn();
await client.TurnOff();
await client.Toggle();

await client.SetBrightness(200);
await client.SetColor(RgbColor.FromHex("FFAA00"));   // selected segments
await client.SetColor(RgbColor.FromHex("FFAA00"), segmentId: 1);
await client.SetEffect(9);                            // by effect id
await client.SetPalette(11);                          // by palette id
await client.SetEffect(Selector.Random);             // random effect
await client.SetPalette(Selector.RandomInRange(5, 10)); // random palette in a range

await client.Reboot();

With no segmentId, SetColor/SetEffect/SetPalette target the currently selected segments (the WLED "seg":{…} object form); pass a segmentId to target one segment.

Reading data

var root  = await client.Get();            // full /json document
var state = await client.GetState();       // /json/state
var info  = await client.GetInformation(); // /json/info

Console.WriteLine($"{info.Name} is running WLED {info.VersionName}.");

Device snapshot

GetDevice() reads /json once and returns a queryable WLedDevice read model that resolves each segment's effect and palette against the device catalogs:

var device = await client.GetDevice();

Console.WriteLine($"{device.Name} — {(device.IsOn ? "on" : "off")} @ {device.Brightness}");

foreach (var segment in device.SelectedSegments)
{
    Console.WriteLine($"Segment {segment.Id}: {segment.Effect.Name} / {segment.Palette.Name}");
}

// Opt in to effect metadata (an extra GET /json/fxdata) when you need it:
var detailed = await client.GetDevice(new DeviceSnapshotOptions { IncludeEffectMetadata = true });

Effect & palette catalogs

Look effects and palettes up by id or name, and apply them type-safely:

var effects = await client.GetEffectCatalog();

var rainbow = effects.FindByName("Rainbow");   // throws if missing/ambiguous
await client.SetEffect(rainbow);

foreach (var entry in effects.AvailableOnly)    // skips reserved RSVD/"-" slots
{
    Console.WriteLine($"{entry.Id}: {entry.Name}");
}

Fluent state updates

Build a sparse update that only sends the fields you set:

await client.UpdateState(update => update
    .TurnOn()
    .Brightness(128)
    .Transition(TimeSpan.FromSeconds(2))   // crossfade, up to ~109 minutes
    .Segment(0, segment => segment
        .Effect(0)
        .Color(RgbColor.FromHex("0066FF"))
        .Speed(200)));

Target the currently selected segments (the WLED "seg":{…} object form) with SelectedSegments(...) instead of an explicit id:

await client.UpdateState(update => update
    .SelectedSegments(segment => segment
        .Effect(9)
        .Palette(11)));

Strong ids & ranges

Range-checked value types catch invalid ids before a request is sent, and flow into the existing int-based APIs:

var preset = PresetId.From(5);                       // throws unless 1–250
var ledmap = LedMapId.From(3);                       // throws unless 0–9

await client.UpdateState(update => update
    .LoadLedMap(ledmap)
    .SelectedSegments(segment => segment
        .Range(SegmentBounds.From(0, 30))));

Individual LED control

await client.SetIndividualLeds(segmentId: 0, leds => leds
    .Set(0, RgbColor.FromHex("FF0000"))
    .SetRange(1, 10, RgbColor.FromHex("00FF00")));

Large updates are transparently and safely split into multiple sequential requests.

Presets & playlists

var presets = await client.GetPresets();
await client.ApplyPreset(1);
await client.SavePreset(5, new SavePresetOptions { Name = "Movie night" });

await client.StartPlaylist(playlist => playlist
    .Add(1, TimeSpan.FromSeconds(10))
    .Add(2, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(1))
    .Repeat(3));

Device configuration

Read configuration and apply safe partial writes with a fluent builder — only the sections and fields you touch are sent:

var config = await client.GetConfig();

await client.UpdateConfig(cfg => cfg
    .Identity(name: "Kitchen", mdnsName: "wled-kitchen")
    .Mqtt(enabled: true, broker: "mqtt.local", port: 1883)
    .BootDefaults(on: true, brightness: 128, presetId: PresetId.From(5)));

Network and access-point changes can disconnect the device, so they require explicit opt-in via UpdateConfigOptions.AllowNetworkChanges.

Error handling

All calls throw a typed exception hierarchy:

try
{
    await client.TurnOn();
}
catch (WledConnectionException) { /* device unreachable / timed out */ }
catch (WledResponseException ex) { /* non-2xx: ex.StatusCode, ex.Body */ }

Every method also accepts an optional CancellationToken.

Supported features

Area Endpoint(s) Supported
Full state/info/effects/palettes GET /json
Device snapshot read model (GetDevice) GET /json (+ fxdata opt-in)
Effect & palette catalogs (lookup by id/name) GET /json/eff, GET /json/pal
Live state + info GET /json/si
State GET/POST /json/state
Device information GET /json/info
Effects & palettes lists GET /json/eff, GET /json/pal
Nearby Wi-Fi networks GET /json/net
Live LED stream GET /json/live
Brightness / on-off / toggle POST /json/state
Per-segment control (effect, palette, colours, options, 2D, grouping…) POST /json/state
Individual LED control (with auto-chunking) POST /json/state
Presets (read / apply / save / delete) presets.json, POST /json/state
Playlists (read / start / save) presets.json, POST /json/state
Effect metadata GET /json/fxdata
Node discovery GET /json/nodes
Device configuration (read / safe partial write) GET/POST /json/cfg
Strong id/range value types (PresetId, LedMapId, SegmentBounds…)
Typed exceptions & cancellation
DI / IHttpClientFactory integration

Samples

The samples folder contains examples of how you could use the WLED.NET library.

Changelog

See CHANGELOG.md.

Contributing

  1. Issue
  2. Fork
  3. Hack!
  4. Pull Request
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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 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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
2.0.65 0 5/30/2026
2.0.62 0 5/30/2026
2.0.60 0 5/30/2026
2.0.54 675 2/18/2025
2.0.53 341 2/13/2025
2.0.52 310 1/23/2025
2.0.50 373 9/19/2024
2.0.48 803 2/2/2023
2.0.46 586 10/3/2022
1.0.43 587 10/3/2022
1.0.41 502 1/8/2022
1.0.40 500 1/8/2022
1.0.37 518 1/8/2022
0.0.31-preview 584 5/2/2020
0.0.30-preview 520 5/2/2020
0.0.29-preview 562 4/25/2020
0.0.28-preview 496 4/18/2020
0.0.26-preview 535 4/18/2020
0.0.25-preview 536 4/18/2020