Code Monkey home page Code Monkey logo

limitlessled's Introduction

Milight/LimitlessLED/EasyBulb Complete PHP API

The complete API of Milight/LimitlessLED/EasyBulb written in PHP. This code has been tested on Wifi Bridge V.4 and is working pretty well. Any help and bugfixes are welcome.

Note (1): There are two different channels for white and RGBW on Wifi Bridge so you can't mix white bulbs with RGBW bulbs on the same group.

Note (2): Brightness (dimming) values for RGBW bulbs are different for white and RGB modes and brightness value is saved in bulbs separately either mode.

Note (3): RGBW bulbs can't mix RGB and white colors, these bulbs only can operate in white or RGB mode so you can't set saturation. Only brightness can be set in RGB mode.

Note (4): Since Wifi Bridge V.4 the web interface for Wifi Bridge configuration has been removed and static IP can be set only from mobile app or using AT commands (currently we are working on adding PHP API for configuration and auto bridge discovery)

Note (4): Web interface is back in new firmware update. You can update the firmware and use web-based interface (by typing IP in browser) to set static IP address.

here's the link to the firmware update file: (the file has been removed from the server!)

http://www.limitlessled.com/download/LIMITLESSLED_FIRMWARE_UPGRADE_V4_BRIDGE_27Nov2014.bin

Warning: I have updated my Wifi bridge V.4 successfully to this firmware version, but you use this update on your own responsibility. Recently I've noticed, the update is breaking some incompatible Wifi bridges.

There are two methods for setting active group one for RGBW bulbs (setRgbwActiveGroup or rgbwSetActiveGroup) and for white bulbs (setWhiteActiveGroup or whiteSetActiveGroup). After setting active channel you will be able to send commands to chosen bulb group.

Bulbs only support 256 colors (not 16 millions) but there is a method for setting RGB hex strings (for example, #FF1254). This is then configured to nearest supported color. It is also possible to provide HSV colors.

Example:

<?php
require 'Milight.php';

$milight = new Milight('192.168.0.54');

$milight->rgbwAllOn();
$milight->rgbwAllSetToWhite();
$milight->rgbwAllBrightnessMax();
sleep(2);
$milight->setRgbwActiveGroup(1);
$milight->rgbwBrightnessPercent(50);
sleep(2);
$milight->setRgbwActiveGroup(2);
$milight->rgbwSetColorHexString('FF1254'); // or #FF1254
$milight->rgbwBrightnessPercent(90);
sleep(2);
$milight->whiteAllOn();
$milight->whiteAllBrightnessMax();
sleep(2);
$milight->whiteGroup1NightMode();
sleep(2);
$milight->setWhiteActiveGroup(2);
$milight->whiteWarmIncrease();
$milight->whiteWarmIncrease();
$milight->whiteWarmIncrease();

Have fun!

limitlessled's People

Contributors

matthewbaggett avatar mrwhale avatar ojarva avatar pcp135 avatar yasharrashedi 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

Watchers

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

limitlessled's Issues

getActiveGroup() does not exist

In the function rgbwSetColorToWhite() it should be getActiveRgbwGroup() instead of getActiveGroup(), because the function getActiveGroup() does not exist.
Cheers, André

Support for Bridge v6/v7

Hi there,

does this api support bridge v6 and the upcoming v7? Will there be a new api supporting the new v7-features?

Regards

Is this project still active?

I'd like to know what's the current status of this project. s it still being developed? Will it work with the actual Milight hardware?

Solved: Using these feature in pure shell script (e.g. in OpenWRT)

Hi!

It's not an issue, but rather I want to say a big Thank You! :)

I have bought couple of Easybulb rgbw bulbs a half a year ago and I didn't know to to communicate with them. All I wanted to do is:

  • turn them on at a specified time via cron on OpenWRT (since this Linux flavor is always running inside the network), since the inbuilt scheduling feature was buggy (let's say unreliable) in the android app.

I couldn't do so far, until I've found your code :) :

  • there's an API on their website (http://easybulb.com/api/) , but didn't work at all
  • their app using internet as well (but what happens if something wrong with the connection?), and feature was buggy
  • tried to contact with the company couple of times, but I didn't get any answer back

Based on your API, here's a simple script on OpenWRT Chaos Chalmer, called e.g. manageEasybulb.sh, what we can use in cron (maybe it will be useful for somebody else as well):

#!/bin/sh
# required packages: netcat coreutils coreutils-sleep

rgbwGroup1On='\x45\x00'
rgbwBrightness80='\x4e\x16'
rgbwSetColorToYellowOrange='\x40\x90'
# last byte is always \x55, will be appended to all commands
lastByte='\x55'

HOST='192.168.10.50'
PORT='8899'

sendCommand() {
    # nc switches: -n: don't resolve dns , -u: use udp , -c: terminate after execution
    printf "$1$lastByte" | /usr/bin/nc -n -u -c "$HOST" "$PORT"
    /usr/bin/sleep 0.3
}

turnOnG1YellowOrange80() {
    sendCommand $rgbwGroup1On
    sendCommand $rgbwSetColorToYellowOrange
    sendCommand $rgbwBrightness80
}

turnOnG1YellowOrange80

Broadcast addresses aren't working

Thanks for the library! I was about to write one myself, so this is going to save me a ton of work.

I'm creating a web page (hosted via Apache on OS X on my LAN) to control my home lights (among other home theater-related stuff). The Milight package works well when I use the bridge's IP address, but when I tried to use the LAN broadcast address (255.255.255.255), I get the following error:

Warning: socket_sendto(): unable to write to socket [13]: Permission denied in blah/Milight.php on line 201

I tried to add a line like this after the socket is created and before the message is sent, but it didn't help:

socket_set_option($socket, SOL_SOCKET, SO_BROADCAST, 1);

I'm a novice PHP user (my day job is .NET development), so I'm not sure if this is a gap in the Milight code or some obscure security issue with PHP and Apache.

Connecting directly to the bridge is fine, but I thought it might be a bit faster to broadcast.

Firmware for v4

Not a bug, but just wondering if you still have a copy of the firmware for the update? I would like to update my bridge to the latest version (cant find it anywhere else!)

Thanks :)

Firmware for the V4

Not a bug, but just wondering if you still have a copy of the firmware for the update? I would like to update my bridge to the latest version (cant find it anywhere else!)

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.