Git Product home page Git Product logo

lifxnet's Introduction

LifxNet

A .NET Standard 1.3 library for LIFX. Supports .NET, UWP, Xamarin iOS, Xamarin Android, and any other .NET Platform that has implemented .NET Standard 1.3+.

For Cloud Protocol based implementation, check out isaacrlevin's repo

Sponsoring

If you like this library and use it a lot, consider sponsoring me. Anything helps and encourages me to keep going.

See here for details: https://github.com/sponsors/dotMorten

NuGet

Get the Nuget package here:

PM> Install-Package LifxNet 

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 async 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 and 2700K Temperature			
	}

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.

lifxnet's People

Contributors

dotmorten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lifxnet's Issues

Changing over time like the web api

I'm working on a project where when i score in the game "Rocket League" i trigger my lights into a matching team color. So far i've succefully made it using the web api, though it's a bit slow, so i want to get it going over lan.
In the web api i can call a function that changes the hue over time smoothly, though i can't seem to find anything like that with your library.
This is what it looks like in action, it changes slowly back to the color it was before scoring: https://imgur.com/a/FjoSa

Some lights are not found

I have four lights, all functioning, all in the same room, same network.
2 of them are found and 2 of them are never found by the library. (it is always the same two)

What could be the reason for that?

An attempt was made to access a socket in a way forbidden by its access permissions

I ran into a System.Net.Sockets.SocketException trying to initialize the LIFX client.

var task = LifxNet.LifxClient.CreateAsync();
{"An attempt was made to access a socket in a way forbidden by its access permissions"}

What's the best way to work around this? My first thought is to run as administrator or some other app manifest permission like "Private (Networks Client & Server)".

Thanks,

~Tim Graupmann

GetDeviceLabelAsync doesn't work

I'm trying the get the label of the device instead of just the Hostname, but the call to GetDeviceLabelAsync doesn't work. It just hangs and never returns.

Consider public setters for Device / LightBulb

At the moment, these types can't be serialized/deserialized in UWP (no reflection as a workaround). I don't want to have to rely on device discovery upon app startup before issuing commands to cached light bulbs and the Lifxnet API only accepts Lightbulb instances for telling it where to send commands.

An alternative would be to provide API overloads allowing MAC, IP, port params etc and I can just cache that data instead rather than Lightbulb instances.

Thanks ;)

Hyper-V network interface interferes with detection

I have a virtual ethernet card added on my system from the installation of Docker in Hyper-V. It is a NAT interface so it doesn't really go anywhere. When this interface is enabled, LifxNet is not able to detect lights on my network. As soon as I disable it, detection works perfectly. I'm not sure what other diagnostic info I can provide, so please let me know and I will be happy to help.

Push New Version to NuGet??

Hey there!

I can't be 100%, but I think the version on NuGet needs to be updated.

Trying this with my project, I'm getting an socket error because it's trying to bind to the address multiple times.

However, in the source for the project, I see you've added socket.reuseaddr to the socket init code, so I'm assuming NuGet needs to be updated.

Could you do this, pretty please? :D

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.