Coder Social home page Coder Social logo

mvkalsbeek / micontrol Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 4.0 1.31 MB

C# application/library for controlling MiLight WiFi enabled lightbulbs

License: GNU General Public License v3.0

C# 100.00%
milight-wifi-controller milight milight-bulbs milight-lamp milight-controller milight-light-bulbs

micontrol's People

Contributors

gitter-badger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

micontrol's Issues

Commands for RGB+CCT

Hi,

Just wanted to give a comment. I'm currently developing a lightcontrol for a Photobooth and i'm using your C# project.
It has taken a while to get a Milight/Miboxer Wallwasher (RGB+CCT) to work with the ibox2. I could get connection to the box, but no light would be turned on. Finally i found out that one of the main reasons was that the lamptype wasn't ok.
In your example for CCT you would use 0x08, but in my case it is 0x07.

Check my examples:

static readonly byte[] ON = { 0x31, 0x00, 0x00, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00 };
static readonly byte[] OFF = { 0x31, 0x00, 0x00, 0x07, 0x03, 0x02, 0x00, 0x00, 0x00 };
static readonly byte[] LINK = { 0x31, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00 };
static readonly byte[] UNLINK = { 0X31, 0X00, 0X00, 0X07, 0X00, 0X00, 0X00, 0X00, 0X00 };

static readonly byte[] WHITE =		{ 0x31, 0x00, 0x00, 0x07, 0x03, 0x05, 0x00, 0x00, 0x00 };
static readonly byte[] BLUE =		{ 0x31, 0x00, 0x00, 0x07, 0x01, 0xBA, 0xBA, 0xBA, 0xBA };
static readonly byte[] AQUA =		{ 0x31, 0x00, 0x00, 0x07, 0x01, 0x85, 0x85, 0x85, 0x85 };
static readonly byte[] RED =		{ 0x31, 0x00, 0x00, 0x07, 0x01, 0xFF, 0xFF, 0xFF, 0xFF };
static readonly byte[] LAVENDER =	{ 0x31, 0x00, 0x00, 0x07, 0x01, 0xD9, 0xD9, 0xD9, 0xD9 };
static readonly byte[] GREEN =		{ 0x31, 0x00, 0x00, 0x07, 0x01, 0x7A, 0x7A, 0x7A, 0x7A };
static readonly byte[] LIME =		{ 0x31, 0x00, 0x00, 0x07, 0x01, 0x54, 0x54, 0x54, 0x54 };
static readonly byte[] ORANGE =		{ 0x31, 0x00, 0x00, 0x07, 0x01, 0x1E, 0x1E, 0x1E, 0x1E };
static readonly byte[] YELLOW =		{ 0x31, 0x00, 0x00, 0x07, 0x01, 0x3B, 0x3B, 0x3B, 0x3B };
static readonly byte[] BRIGHTNESS = { 0x31, 0x00, 0x00, 0x07, 0x02, 0x64, 0x00, 0x00, 0x00 };

static readonly byte[] MODE =		{ 0x31, 0x00, 0x00, 0x07, 0x06, 0x02, 0x00, 0x00, 0x00 };
static readonly byte[] MODEDECREASE = { 0x31, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00 };
static readonly byte[] MODEINCREASE = { 0x31, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00, 0x00 };

Split commands to subclasses

The MiController class has become quite a mess with methods for RGBW, RGB and White light bulbs. It might be better to refactor these to subclasses.

Commands might get a syntax like:

Controller.RGB.SwitchOn();
Controller.RGBW.SetColor(2, Color.Blue);

Design beta GUI

Design a fully usable GUI for the beta release, using all the functionality supported by the MiController class.

Add multiple 'MiController' constructors

Add more ways of initializing an instance of the MiController class. For instance not only accepting the IP-address of the MiLight WiFi controller as a string but also as a System.Net.IPAddress.

Update ReadMe and Wiki

After pulling the new refactor branch, update the ReadMe and Wiki according to the changes.

Make command delay variable

Currently, when AutoDelay is set to true on an instance of the MiController class, an automatic delay (Thread.Sleep) of 50ms is done after sending a command to the the controller. This delay can be 'modified' by setting AutoDelay to false and implementing your own delay 'handling'.

Making the delay variable might be a welcome addition.

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.