Skip to content

MarkusHorstmann/LifxNet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LifxNet

A .NET library for LIFX

Tested with LIFX 2.0 Firmware.

Based on the official LIFX protocol docs

####Usage

	client = await LifxNet.LifxClient.CreateAsync();
	client.DeviceDiscovered += Client_DeviceDiscovered;
	client.DeviceLost += Client_DeviceLost;
	client.StartDeviceDiscovery();

...

	private void Client_DeviceDiscovered(object sender, LifxNet.LifxClient.DeviceDiscoveryEventArgs e)
	{
		var bulb = e.Device as LifxNet.LightBulb;
		await client.SetDevicePowerStateAsync(bulb, true); //Turn bulb on
		await client.SetColorAsync(bulb, Colors.Red, 2700); //Set color to Red			
  }

See the sample apps for more examples.

Note: Be careful with sending too many messages to your bulbs - LIFX recommends a max of 20 messages pr second pr bulb. This is especially important when using sliders to change properties of the bulb - make sure you use a throttling mechanism to avoid issues with your bulbs. See the sample app for one way to handle this.

About

A .NET library for LIFX

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 98.3%
  • PowerShell 1.7%