Giter Club home page Giter Club logo

magic-home's Introduction

Magic Home NuGet

.NET Library that allows you to control Magic Home enabled lights connected to the same LAN. With this, you can control your bulbs and led strips that work with the Magic Home App.

This library is also available in Dart.

Requirements

  • A bulb or led strip that works with the Magic Home app;
  • Your device connected to the same network as the light.

Quick Example

var discoveredLights = await Light.DiscoverAsync();

if (discoveredLights?.Count > 0)
{
  var light = discoveredLights[0];

  // Connect.
  await light.ConnectAsync();

  // Check if it is ON.
  if (light.Power == false)
      await light.TurnOnAsync();

  // Change color to green.
  await light.SetColorAsync(0, 255, 0);

  // Print to console light's status.
  Console.WriteLine(light.ToString());
}

Available in the DOCS.md file.

Installation

NuGet

.NET CLI dotnet add package MagicHomeAPI --version 1.4.0

Features

  • Discover lights on LAN;
  • Turn on/off;
  • Use color and warm white;
  • Turn preset and custom patterns;
  • Use time.

Missing features:

  • Music and microphone;
  • Use built-timers;
  • Other fancy stuff;
  • Administration to set WiFi SSiD key.

Contribute and support

If you need any help or request, open an issue or leave an email. I will answer immediately. If you randomly get errors, it might be because of the light so I can't help it.

I'm also open to collaboration.

magic-home's People

Contributors

danielabbatt avatar deankevorkian avatar nathanielxd 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

Watchers

 avatar  avatar  avatar  avatar

magic-home's Issues

Facing troubles with logs directory and Docker

First of all, kudos to you for making such a library, been looking for this for .NET.

However, there's an issue when I try to instantiate a new Light object. It's not able to create the logs directory in Docker.

Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
System.IO.IOException: Invalid argument
   at System.IO.FileSystem.CreateDirectory(String fullPath)
   at System.IO.Directory.CreateDirectory(String path)
   at MagicHome.Light..ctor(IPEndPoint endpoint)

Directory.CreateDirectory(Assembly.GetExecutingAssembly().Location + "\\Logs");

Suggestion: Maybe provide an option to disable logs, or better: expose an event handler that gets invoked each time a new log message arrives. This way it's fully optional without any weird quirks.

Previous versions

Hi, I was using the 1.2.0 release in my project, upgraded to 1.4.0 but since I'm having problem with the release I want to go back to 1.2.0.
Could you mind uploading the 1.2.0 version to the NuGet repository?

Breaking changes

When you make major (breaking) changes like between version 1.2 and 1.4 you should increase the major version number and not the minor version number. And why not keep the older versions on nuget so we can go back when we realise that all our code is broken after updating?

Sorry to sound harsh, I appreciate the work you've put into this but it is annoying when you upgrade a package and then find yourself stuck with work you weren't planning to do in the first place not able to revert easily.

LED Type (RGB/RGBW)

Hello Dear.

I have RGB and RGBW led controller and i want to distinguish these two type of LEDs.

Is there any command that determined whether the led is RGB or RGBW?

Thank you.

Issues setting colour for Warm/Cool Magic Home bulb

We have a standard RBG strip, and then we have an RGB bulb that has the cool/warm option (when we interact with it via the app).

Running the same code for both strip and bulb, they both turn on / off fine, but setting the colour doesn't work for the bulb (but does work for the strip). I've debugged it and the RGB value is being set for the bulb as expect, but the light isn't actually changing colour. We have tried calling refresh on it after changing colour. We have tried calling SetColdWhiteAsync after setting it to a different colour on the phone app, and it doesn't change either.

Addressable LED strip

I'm wondering if it's possible to change individual lights on addressable LED strips using this API, if it is how would I go about doing that?

Lights flickering

I noticed my lights flicker/flash to white before setting the color.
I'm wondering if this is an issue with my lights or something else?
Code that causes issues:

await lights.setColorAsync(255, 0, 0); // all colors cause flashes

The other way around?

Hey! I'm thinking of syncing my RGB keyboard to my magic home LED strips, and therefore I'm wondering whether the reverse engineering work you did could be reversed, so a UDP socket listening on my computer could send a fake response to the Magic Home app, pretending to be a real LED controller?

Thanks!

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.