YeelightAPI 1.0.4

Xiaomi yeelight smart-bulb manager

There is a newer version of this package available.
See the version list below for details.
Install-Package YeelightAPI -Version 1.0.4
dotnet add package YeelightAPI --version 1.0.4
<PackageReference Include="YeelightAPI" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YeelightAPI --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

YeelightAPI

C# API to control Xiaomi Yeelight Color Bulbs

Prerequisites

The console project uses C# 7.1 "Async Main Method" Feature, make sure your visual studio version is up to date !

Usage

The YeelightAPI.DeviceManager allows you to connect to a bulb. Just instanciate the manager : DeviceManager manager = new DeviceManager(); and initiate connection to your bulb IP adress : manager.Connect(&quot;XXX.XXX.XXX.XXX&quot;);.
Then you can use the manager to control the bulb :

  • Power on / off : manager.SetPower(true);
  • Toggle State : manager.Toggle();
  • Change brightness level : manager.SetBrightness(100);
  • Change color : manager.SetRGBColor(80, 244, 255);

Some methods use an optional parameter named "smooth", it refers to the duration in milliseconds of the effect you want to apply. For a progressive brightness change, use manager.SetBrightness(100, 3000);.

If you need a method that is not implemented, you can use the folowing methods :

  • ExecuteCommandWithResponse(METHODS method, int id = 0, List&lt;object&gt; parameters = null, int? smooth = null) (with response)
  • ExecuteCommand(METHODS method, int id = 0, List&lt;object&gt; parameters = null, int? smooth = null) (without response).

These methods are generic and use the METHODS enumeration and a list of parameters, which allows you to call any known method with any parameter.

Event

When you call a method that changes the state of the bulb, it sends a notification to inform that its state really change. You can receive these notification using the "NotificationReceived"
Example :

   manager.NotificationReceived += (object sender, NotificationReceivedEventArgs arg) =>
   {
       Console.WriteLine("Notification received !! value : " + JsonConvert.SerializeObject(arg.Result));
   };

VNext

  • turn into a nuget package
  • handle dns host name for bulb discovery
  • add device discovery method in the DeviceManager
  • add more native methods in the DeviceManager
  • correct bugs if needed

Help

If there is a functionality that you need which is not implemented, or even worse if there is a bug, you can create a pull request.

Licence

Apache Licence

Source

This code is an implementation of the ["Yeelight WiFi Light Inter-Operation Specification"](http://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf "Link to Yeelight WiFi Light Inter-Operation Specification") as defined on January 1st, 2018

YeelightAPI

C# API to control Xiaomi Yeelight Color Bulbs

Prerequisites

The console project uses C# 7.1 "Async Main Method" Feature, make sure your visual studio version is up to date !

Usage

The YeelightAPI.DeviceManager allows you to connect to a bulb. Just instanciate the manager : DeviceManager manager = new DeviceManager(); and initiate connection to your bulb IP adress : manager.Connect(&quot;XXX.XXX.XXX.XXX&quot;);.
Then you can use the manager to control the bulb :

  • Power on / off : manager.SetPower(true);
  • Toggle State : manager.Toggle();
  • Change brightness level : manager.SetBrightness(100);
  • Change color : manager.SetRGBColor(80, 244, 255);

Some methods use an optional parameter named "smooth", it refers to the duration in milliseconds of the effect you want to apply. For a progressive brightness change, use manager.SetBrightness(100, 3000);.

If you need a method that is not implemented, you can use the folowing methods :

  • ExecuteCommandWithResponse(METHODS method, int id = 0, List&lt;object&gt; parameters = null, int? smooth = null) (with response)
  • ExecuteCommand(METHODS method, int id = 0, List&lt;object&gt; parameters = null, int? smooth = null) (without response).

These methods are generic and use the METHODS enumeration and a list of parameters, which allows you to call any known method with any parameter.

Event

When you call a method that changes the state of the bulb, it sends a notification to inform that its state really change. You can receive these notification using the "NotificationReceived"
Example :

   manager.NotificationReceived += (object sender, NotificationReceivedEventArgs arg) =>
   {
       Console.WriteLine("Notification received !! value : " + JsonConvert.SerializeObject(arg.Result));
   };

VNext

  • turn into a nuget package
  • handle dns host name for bulb discovery
  • add device discovery method in the DeviceManager
  • add more native methods in the DeviceManager
  • correct bugs if needed

Help

If there is a functionality that you need which is not implemented, or even worse if there is a bug, you can create a pull request.

Licence

Apache Licence

Source

This code is an implementation of the ["Yeelight WiFi Light Inter-Operation Specification"](http://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf "Link to Yeelight WiFi Light Inter-Operation Specification") as defined on January 1st, 2018

Release Notes

Refactoring and lock during tcp calls to prevent multiple-thread access

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.7.0 116 12/15/2019
1.6.0 50 12/7/2019
1.5.2 135 10/14/2019
1.5.1 67 10/10/2019
1.5.0 1,833 8/25/2018
1.4.1 234 8/7/2018
1.4.0 375 7/13/2018
1.3.3 338 4/29/2018
1.3.2 247 4/3/2018
1.3.1 286 3/22/2018
1.3.0 280 3/5/2018
1.2.3 288 2/25/2018
1.2.2 326 2/22/2018
1.2.1 381 2/15/2018
1.2.0 313 2/15/2018
1.1.5 324 2/9/2018
1.1.4 285 2/7/2018
1.1.3 285 2/4/2018
1.1.2 253 1/28/2018
1.1.1 242 1/28/2018
1.1.0 281 1/27/2018
1.0.6 341 1/7/2018
1.0.5 353 1/7/2018
1.0.4 383 1/6/2018
1.0.2 355 1/3/2018
1.0.1 299 1/3/2018
1.0.0 333 1/3/2018
Show less