GithubHelp home page GithubHelp logo

ginomessmer / magic-home-dotnet Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 30 KB

A reverse engineered library for Magic Home enabled smart light devices for .NET Core

License: MIT License

C# 100.00%
magic-home magic-home-control smart-light smart-home light light-controller dotnet dotnet-core

magic-home-dotnet's Introduction

Magic Home Light SDK for .NET

Build Status https://www.nuget.org/packages/MagicHome.NET

This unofficial library lets you control Magic Home enabled lights that are connected to the same local area network.

Requirements

  • .NET Standard 2.0 or above
  • Magic Home enabled smart home light device that runs on LEDENET

Features

  • Connect to lights in network
  • Read properties of light
  • Set various properties of light such as power state, color
  • Easy to use

Install

Get it from https://www.nuget.org/packages/MagicHome.NET or with your favorite CLI tool:

Install-Package MagicHome.NET
dotnet add package MagicHome.NET

Show me the code

var light = new Light();
await light.ConnectAsync("192.168.0.10");

Console.WriteLine(light.Color);

await light.TurnOnAsync();

await light.SetColorAsync(Color.Red);
await Task.Delay(500);

await light.SetColorAsync(255, 255, 255);
await Task.Delay(500);

await light.RestoreAsync();
light.Dispose();

Credit where credit is due

This project was heavily inspired by

magic-home-dotnet's People

Contributors

ginomessmer avatar

Stargazers

 avatar

Watchers

 avatar

magic-home-dotnet's Issues

SetColor Not Working

In calling SetColor, no color changes are taking place for my bulb. Connectivity with the bulb has been verified as other methods like TurnOff work as intended.

I did some inspection of packets from the Magic Home android app and found some differences in the bytes being sent to the bulb. Changing the first parameter from 0x41 to 0x31 and the second to last parameter from 0x0f to 0xf0 of the SendData call in SetColor corrects the issue for me.
SendData(new byte[] { 0x31, R, G, B, 0x00, 0xf0, 0x0f });

With these changes calls to SetColor work consistently for me. However, I only have one Magic Home light bulb. So, I don't have a way to broadly test this.

Looking in the device information screen on my android app, my bulb is listed with a firmware version of 44.v9.34.6887-a

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.