YeelightNET 1.2.0

Requires NuGet 2.12 or higher.

dotnet add package YeelightNET --version 1.2.0                
NuGet\Install-Package YeelightNET -Version 1.2.0                
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="YeelightNET" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YeelightNET --version 1.2.0                
#r "nuget: YeelightNET, 1.2.0"                
#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 YeelightNET as a Cake Addin
#addin nuget:?package=YeelightNET&version=1.2.0

// Install YeelightNET as a Cake Tool
#tool nuget:?package=YeelightNET&version=1.2.0                

Yeelight.NET

C#.NET Api used to control xiaomi yeelight devices over the Local Area Network.

Installation

NUGET

Using Nuget Package Manager:

Install-Package YeelightNET

Usage

Reference the compiled class or insert the source code into your project.

Discovering devices

IMPORTANT !

In order to discover and control the xiaomi yeelight devices in the local network, you have to download and install yeelight app and enable the LAN control for each device.

Android Application: https://play.google.com/store/apps/details?id=com.yeelight.cherry&hl=en IOS Application: https://itunes.apple.com/gb/app/yeelight/id977125608?mt=8

To get a list of devices, simply use the async function:

List<Device> devices = await Yeelight.DiscoverDevices(timeout:2500);
OR
List<Device> devices = Yeelight.DiscoverDevices().Result; //for synchronous

You should also let firewall to allow request in the first run.

Controlling

The API designed in a fluent fashion so you can chain methods to control devices with an organized code. Ex: devices[0].Toggle().SetBrightness(20).WaitCmd(2000).SetRgbColor(0,255,0).WaitCmd(5000).SetBrightness(5).SetColorTemperature(2000);

These device functions are extension methods on device class in YeelightFunctions static class.

The onPropertyChanged event can be used to notify when a property changes through indexer of Device class.

Reading values

Read values through indexer of Device class. It takes DeviceProperty enum for parameter. Ex:

 mDevice[Yeelight.DeviceProperty.Brightness]
 mDevice[Yeelight.DeviceProperty.ColorTemperature]
 mDevice[Yeelight.DeviceProperty.Name]

Yeelight Documentation

https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf

License

This project is licensed under the GNUv3 License - see the LICENSE file for details.

Contact

Contact for any bugs or requests.

berkaygursoy@gmail.com

There are no supported framework assets in this 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
1.2.0 561 5/21/2022
1.1.1 1,014 12/15/2018
1.1.0 1,023 1/26/2018
1.0.0 949 1/23/2018

V1.2.0
- Port to .NET 6
- Async device discovery timeout