RGB.NET.Devices.WLED
2.1.0
See the version list below for details.
dotnet add package RGB.NET.Devices.WLED --version 2.1.0
NuGet\Install-Package RGB.NET.Devices.WLED -Version 2.1.0
<PackageReference Include="RGB.NET.Devices.WLED" Version="2.1.0" />
paket add RGB.NET.Devices.WLED --version 2.1.0
#r "nuget: RGB.NET.Devices.WLED, 2.1.0"
// Install RGB.NET.Devices.WLED as a Cake Addin #addin nuget:?package=RGB.NET.Devices.WLED&version=2.1.0 // Install RGB.NET.Devices.WLED as a Cake Tool #tool nuget:?package=RGB.NET.Devices.WLED&version=2.1.0
RGB.NET Device-Provider-Package for WLED-devices.
Usage
This provider does not load anything by default and requires additional configuration to work.
// Add as many WLED-devices as you like
WledDeviceProvider.Instance.AddDeviceDefinition(new WledDeviceDefinition("<hostname>"));
surface.Load(WledDeviceProvider.Instance);
You can also override the manufacturer and device model in the DeviceDefinition.
Required SDK
This provider does not require an additional SDK.
UDP realtime needs to be enabled on the WLED device.
Automatic device discovery
Due to the requirement of an additional dependency and the requirement to be able to configure devices manually anywy automatic discovery is not part of the provider.
Using the nuget Tmds.MDns
you can use the following Helper to do this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Tmds.MDns;
namespace RGB.NET.Devices.WLED;
public static class WledDiscoveryHelper
{
/// <summary>
/// Searches for WLED devices and returns a list of devices found.
/// </summary>
/// <param name="waitFor">The time the discovery is waiting for responses. Choose this as short as possible as the method is blocking </param>
/// <param name="maxDevices">The maximum amount of devices that are expected in the network. The discovery will stop early if the given amount of devices is found.</param>
/// <returns>A list of addresses and device-infos.</returns>
public static IEnumerable<(string address, WledInfo info)> DiscoverDevices(int waitFor = 500, int maxDevices = -1)
{
List<(string address, WledInfo info)> devices = [];
using ManualResetEventSlim waitEvent = new(false);
int devicesToDetect = maxDevices <= 0 ? int.MaxValue : maxDevices;
ServiceBrowser mdns = new();
mdns.ServiceAdded += OnServiceAdded;
mdns.StartBrowse("_http._tcp");
waitEvent.Wait(TimeSpan.FromMilliseconds(waitFor));
mdns.StopBrowse();
mdns.ServiceAdded -= OnServiceAdded;
return devices;
void OnServiceAdded(object? sender, ServiceAnnouncementEventArgs args)
{
string address = args.Announcement.Addresses.FirstOrDefault()?.ToString() ?? string.Empty;
if (!string.IsNullOrWhiteSpace(address))
{
WledInfo? info = null;
try
{
info = WledAPI.Info(address);
}
catch { }
if (info != null)
{
devices.Add((address, info));
if (--devicesToDetect <= 0)
waitEvent.Set();
}
}
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 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 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. |
-
net6.0
- RGB.NET.Core (>= 2.1.0)
-
net7.0
- RGB.NET.Core (>= 2.1.0)
-
net8.0
- RGB.NET.Core (>= 2.1.0)
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 |
---|---|---|
3.0.0-prerelease.3 | 70 | 10/20/2024 |
3.0.0-prerelease.2 | 54 | 9/26/2024 |
3.0.0-prerelease.1 | 59 | 7/21/2024 |
2.2.0-prerelease.1 | 66 | 6/22/2024 |
2.1.1-prerelease.3 | 64 | 6/10/2024 |
2.1.1-prerelease.2 | 60 | 5/27/2024 |
2.1.1-prerelease.1 | 72 | 4/11/2024 |
2.1.0 | 189 | 3/9/2024 |
2.1.0-prerelease.11 | 59 | 4/10/2024 |
2.1.0-prerelease.6 | 63 | 3/8/2024 |
2.0.4-prerelease.20 | 64 | 3/8/2024 |
2.0.4-prerelease.18 | 68 | 3/8/2024 |
2.0.4-prerelease.16 | 81 | 2/12/2024 |
2.0.4-prerelease.14 | 83 | 1/28/2024 |
2.0.4-prerelease.12 | 77 | 1/18/2024 |
2.0.4-prerelease.10 | 60 | 1/18/2024 |
2.0.0 | 139 | 3/8/2024 |