Mi-Light Plug-in

Questions and comments specific to a particular plugin should go here.
_RIGHT_H
Posts: 17
Joined: Sat Apr 18, 2015 2:19 am

Re: Mi-Light Plug-in

Post by _RIGHT_H » Sat Jan 30, 2016 8:59 am

I wish . i know what you mean , i have linked the lights to a LightwaveRF door sensor(Thank you krambriw soooo much the best plugin) so whenever we open the door the lights turn on. but my family says it too bright it should always fade-in.
so my only solution for now:

to Power ON Lights:
Power ON action and set the brightness to 0
then use power ON action again and set brightness to 100% OR use set brightness action.

and most importantly when you turn off the lights you MUST set brightness to 0 first then use power off action so when turn the lights back on it does not start at 100%.
or try using fade-in fade-out actions

its not perfect but its the only solution i know for now
hope this helps

SupahNoob
Posts: 21
Joined: Mon Jun 29, 2015 11:32 pm

Re: Mi-Light Plug-in

Post by SupahNoob » Fri Feb 05, 2016 6:24 am

_RIGHT_H wrote:I wish . i know what you mean ...
He means exactly what you have said. Would add an option in your code (checkbox on config labeled soft-toggle, soft-off, soft-on) and have a conditional linked to a decrementing for-else-loop on the brightness parameter for the wifi bridge. This is how I do it in my script. Unfortunately, this requires you to then save the current brightness level for each group in the script. This way, you set args in your script to start at current group brightness level, decrement by 1 (out of the 27 brightness steps) until you get to 0. In the else condition, call the OFF command.

I have this implemented as the default and give no way to change it. I found switching from off to X brightness was too jarring.

Hope this helps,
- SN

Foune
Experienced User
Posts: 88
Joined: Sun Jul 03, 2011 7:08 pm

Re: Mi-Light Plug-in

Post by Foune » Fri Feb 05, 2016 9:30 am

Would you mind sharing your script?
Is this working with a RGBW strip/bulb?
The LimitlessLED bulb remembers its own Brightness setting memory separately for ColorRGB and separately for White. For example dimming Green, then switching to White full brightness, and when you go back to a specific color the brightness returns to what the ColorRGB was before. Same vice versa for the White. The previous brightness setting is remembered specifically for the White and specifically for the ColorRGB.
I'm afraid this kind of script won't combine smoothly with the genuine remote. In my case, the remote is on the wall like a standard switch, I use the milight as the main light in my livving room.

By the way, maybe the night mode would be a decent compromise? I mean Power on = night mode -> full mode, idem when switching off...
During this time, I've been asking electronics experts if it was possible to add a soft effect by adding components on my strip (for instance a big capacitor). Looks like it wouldn't be as easy as I expected.

Hereunder I remind the different functions available.

Code: Select all

// White LEDs
        public static readonly byte[] AllOn = new byte[] { 0x35, 0x0, 0x55 };
        public static readonly byte[] AllOff = new byte[] { 0x39, 0x0, 0x55 };
        public static readonly byte[] BrightnessUp = new byte[] { 0x3C, 0x0, 0x55 };
        public static readonly byte[] BrightnessDown = new byte[] { 0x34, 0x0, 0x55 };
        public static readonly byte[] ColorTempDown = new byte[] { 0x3F, 0x0, 0x55 };
        public static readonly byte[] Group1On = new byte[] { 0x38, 0x0, 0x55 };
        public static readonly byte[] Group1Off = new byte[] { 0x3B, 0x0, 0x55 };
        public static readonly byte[] Group2On = new byte[] { 0x3D, 0x0, 0x55 };
        public static readonly byte[] Group2Off = new byte[] { 0x33, 0x0, 0x55 };
        public static readonly byte[] Group3On = new byte[] { 0x37, 0x0, 0x55 };
        public static readonly byte[] Group3Off = new byte[] { 0x3A, 0x0, 0x55 };
        public static readonly byte[] Group4On = new byte[] { 0x32, 0x0, 0x55 };
        public static readonly byte[] Group4Off = new byte[] { 0x36, 0x0, 0x55 };
        public static readonly byte[] AllFull = new byte[] { 0xB5, 0x0, 0x55 };
        public static readonly byte[] Group1Full = new byte[] { 0xB8, 0x0, 0x55 };
        public static readonly byte[] Group2Full = new byte[] { 0xBD, 0x0, 0x55 };
        public static readonly byte[] Group3Full = new byte[] { 0xB7, 0x0, 0x55 };
        public static readonly byte[] Group4Full = new byte[] { 0xB2, 0x0, 0x55 };
        public static readonly byte[] AllNight = new byte[] { 0xB9, 0x0, 0x55 };
        public static readonly byte[] Group1Night = new byte[] { 0xBB, 0x0, 0x55 };
        public static readonly byte[] Group2Night = new byte[] { 0xB3, 0x0, 0x55 };
        public static readonly byte[] Group3Night = new byte[] { 0xBA, 0x0, 0x55 };
        public static readonly byte[] Group4Night = new byte[] { 0xB6, 0x0, 0x55 };
        public static readonly byte[] ColorTempUp = new byte[] { 0x3E, 0x0, 0x55 };
        // RGB LEDs
        public static readonly byte[] RGBOn = new byte[] { 0x22, 0x0, 0x55 };
        public static readonly byte[] RGBOff = new byte[] { 0x21, 0x0, 0x55 };
        public static readonly byte[] RGBBrightnessUp = new byte[] { 0x23, 0x0, 0x55 };
        public static readonly byte[] RGBBrightnessDown = new byte[] { 0x24, 0x0, 0x55 };
        public static readonly byte[] RGBSpeedUp = new byte[] { 0x25, 0x0, 0x55 };
        public static readonly byte[] RGBSpeedDown = new byte[] { 0x26, 0x0, 0x55 };
        public static readonly byte[] RGBDiscoNext = new byte[] { 0x27, 0x0, 0x55 };
        public static readonly byte[] RGBDiscoLast = new byte[] { 0x28, 0x0, 0x55 };
        public static readonly byte[] RGBColour = new byte[] { 0x20, 0x0, 0x55 };
        //RGBW LEDs   
        public static readonly byte[] RGBWOff = new byte[] { 0x41, 0x0, 0x55 };
        public static readonly byte[] RGBWOn = new byte[] { 0x42, 0x0, 0x55 };
        public static readonly byte[] RGBWDiscoSpeedSlower = new byte[] { 0x43, 0x0, 0x55 };
        public static readonly byte[] RGBWDiscoSpeedFaster = new byte[] { 0x44, 0x0, 0x55 };
        public static readonly byte[] RGBWGroup1AllOn = new byte[] { 0x45, 0x0, 0x55 };
        public static readonly byte[] RGBWGroup1AllOff = new byte[] { 0x46, 0x0, 0x55 };
        public static readonly byte[] RGBWGroup2AllOn = new byte[] { 0x47, 0x0, 0x55 };
        public static readonly byte[] RGBWGroup2AllOff = new byte[] { 0x48, 0x0, 0x55 };
        public static readonly byte[] RGBWGroup3AllOn = new byte[] { 0x49, 0x0, 0x55 };
        public static readonly byte[] RGBWGroup3AllOff = new byte[] { 0x4A, 0x0, 0x55 };
        public static readonly byte[] RGBWGroup4AllOn = new byte[] { 0x4B, 0x0, 0x55 };
        public static readonly byte[] RGBWGroup4AllOff = new byte[] { 0x4C, 0x0, 0x55 };
        public static readonly byte[] RGBWDiscoMode = new byte[] { 0x4D, 0x0, 0x55 };
        public static readonly byte[] SetColorToWhite = new byte[] { 0xC2, 0x0, 0x55 };
        public static readonly byte[] SetColorToWhiteGroup1 = new byte[] { 0xC5, 0x0, 0x55 };
        public static readonly byte[] SetColorToWhiteGroup2 = new byte[] { 0xC7, 0x0, 0x55 };
        public static readonly byte[] SetColorToWhiteGroup3 = new byte[] { 0xC9, 0x0, 0x55 };
        public static readonly byte[] SetColorToWhiteGroup4 = new byte[] { 0xCB, 0x0, 0x55 };
        public static readonly byte[] RGBWBrightness = new byte[] { 0x4E, 0x0, 0x55 };
        public static readonly byte[] RGBWColor = new byte[] { 0x40, 0x0, 0x55 };

Foune
Experienced User
Posts: 88
Joined: Sun Jul 03, 2011 7:08 pm

Re: Mi-Light Plug-in

Post by Foune » Fri Feb 05, 2016 9:43 am

Last thing, can you confirm these two flaws?

Seen in : https://github.com/ojarva/python-ledcontroller
There is automatic 100ms pause between each command. Almost every action requires sending more than one command, thus requiring several hundred milliseconds. You can change this with keyword argument "pause_between_commands". However, decreasing the delay will cause some commands to fail.
As the gateway seems to be rather unreliable, all commands are sent multiple times (three by default). If you want to change this, use "LedController(ip, repeat_commands=n)" to create new lightcontroller instance. It is not possible to retrieve any status information from light bulbs.

Foune
Experienced User
Posts: 88
Joined: Sun Jul 03, 2011 7:08 pm

Re: Mi-Light Plug-in

Post by Foune » Thu Feb 11, 2016 12:24 pm

Hello everybody,

I finally coud test both Plugins ( SupahNoob and _RIGHT_H).
The fade-in and fade-out feature of _RIGHT_H are really perfect! No need to check if the bulb is ON, launching "fade-in" on a powered-off bulb works flawlessly, so there is no flash : perfect!

I could create a scenario linked with kodi, it's just like in a cinema 8) : start/stop/play/pause, each time a smart fade in/out.

The only limitation I want to discuss with you, is the support of the older RGB protocol. We could say "well, RGB refers to obsolete devices, let's forget". My 2 RGBW Led strip controllers are using the old RGB protocol, and I may be interesting to suppport it.

Image

I did a few tests, and discovered that my brand new 9w milight spot bulb is RGBW, so working with your scripts, and in the same time fully backward compatible with RGB protocol.

Image

About the changes on your code : the main difference between RGB and RGBW protocol, is the prefix that changed from 2x to 4x, and the zone management. On a quick and dirty approach, changing the prefix code only would work without re-writing all your plugins.


So this is the todo list I propose :

- Use a prefix code table : RGB / RGBW
- Allow the "multi instance" mode, so that one can instanciate one plugin for each mode (optionnal)

Sooner or later I'll make a dirty test. Let me know your opinion about this upgrade.

Code: Select all

LimitlessLED RGB
------------------
22 00 55 - Lamps On
21 00 55 - Lamps Off
23 00 55 - Brightness Up
24 00 55 - Brightness Down (There are nine steps between min and max)
27 00 55 - Mode Up
28 00 55 - Mode Down (There are 20 modes. The lowest is constant white)
25 00 55 - Speed Up (Fast)
26 00 55 - Speed Down (Slow)
20 xx 55 - Set Colour to xx

LimitlessLED RGBW
-------------------
41 00 55 - All Off
42 00 55 - All On
43 00 55 - Speed Down (One Step Slower Disco)
44 00 55 - Speed Up (One Step Faster Disco)
45 00 55 - Zone 1 On
46 00 55 - Zone 1 Off
47 00 55 - Zone 2 On
48 00 55 - Zone 2 Off
49 00 55 - Zone 3 On
4A 00 55 - Zone 3 Off
4B 00 55 - Zone 4 On
4C 00 55 - Zone 4 Off
4D 00 55 - One Step Disco Mode Up (20 Disco Modes)
42 00 55 wait 100ms then send C2 00 55 - All Zones Change back to Warm White.
45 00 55 wait 100ms then send C5 00 55 - Zone 1 Change back to Warm White.
47 00 55 wait 100ms then send C7 00 55 - Zone 2 Change back to Warm White.
49 00 55 wait 100ms then send C9 00 55 - Zone 3 Change back to Warm White.
4B 00 55 wait 100ms then send CB 00 55 - Zone 4 Change back to Warm White.
42 00 55 wait 100ms then send 4E XX 55 - Set All to Brightness XX (XX range is 0x02 to 0x1B)
45 00 55 wait 100ms then send 4E XX 55 - Set Zone 1 to Brightness XX (XX range is 0x02 to 0x1B)
47 00 55 wait 100ms then send 4E XX 55 - Set Zone 2 to Brightness XX (XX range is 0x02 to 0x1B)
49 00 55 wait 100ms then send 4E XX 55 - Set Zone 3 to Brightness XX (XX range is 0x02 to 0x1B)
4B 00 55 wait 100ms then send 4E XX 55 - Set Zone 4 to Brightness XX (XX range is 0x02 to 0x1B)
42 00 55 wait 100ms then send 40 XX 55 - Set All to Color XX (XX range is 0x00 to 0xFF)
45 00 55 wait 100ms then send 40 XX 55 - Set Zone 1 to Color XX (XX range is 0x00 to 0xFF)
47 00 55 wait 100ms then send 40 XX 55 - Set Zone 2 to Color XX (XX range is 0x00 to 0xFF)
49 00 55 wait 100ms then send 40 XX 55 - Set Zone 3 to Color XX (XX range is 0x00 to 0xFF)
4B 00 55 wait 100ms then send 40 XX 55 - Set Zone 4 to Color XX (XX range is 0x00 to 0xFF)
To me, the main advantages of LED Strips with the RGB protocol is that they CAN produce bright pastel colors, as they can combine white + color outputs. Unfortunately this is achieved using a trick : there is to set a specific "disco" mode to combine white + color. Which is not easy to control by script (but not impossible).

I have a spare controller using the RGBW protocol, I'll test it to check the difference with the older ones, but I'm not shure it can combine White + Color. One thing I found disappointing on the new protocol, is that the disco modes can't be adressed directly, and worse, you can't do "up/down" like the older one, but only "up". Because there are 20 programs, it is really a pity.

Windhowl
Posts: 11
Joined: Wed Apr 06, 2016 5:41 pm

Re: Mi-Light Plug-in

Post by Windhowl » Wed Apr 13, 2016 3:59 pm

Hey ,
I have multiple led stripes and want them to power on simultaneously with the fade command. The problem is eventghost executes the commands for each led stripe step by step but not at the same time.
Is there a way to power 3 led stripes up at the same time ? Maybe in python ?

I would really love to hear some suggestions! :)

Greetings Windhowl

Foune
Experienced User
Posts: 88
Joined: Sun Jul 03, 2011 7:08 pm

Re: Mi-Light Plug-in

Post by Foune » Wed Apr 13, 2016 4:58 pm

Hello,

I have planned to rewrite some parts of this plug-in. The main improvement would be introducing threads.
Currently, when you ask the plugin a fade in or out, eventghost stays frozen until it is done. Its a big issue, as my remote don't respond during the mean time, and I can't synchronize two channels, just like you.

I've already solved this problem by using threads when I wrote my Foscam Camera plug-in.

Using threads, the user can throw multiple commands without having to wait.
Another powerful feature can be easily done using threads : create permanent home DIY scenarios, fades, etc.
For instance : select three colors and fade each one at a selected speed, indefinitely, until you send a specific "eg.milight.fadestop" command from your remote, for instance.

This feature can be easily taken from my foscam plugin : I wrote a similar function called "Patrol", which purpose is to move the camera from position 1 to position 2 after a specific delay. This feature can be started and stopped at any time.

Unfortunately, I have no time to write a clean upgrade of the milight plugin for the next weeks.

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Mi-Light Plug-in

Post by kgschlosser » Wed Apr 13, 2016 6:57 pm

if you use threading on each call to the ramping up or down feature it will work without waiting for another command to finish.

but you have to be careful and make sure you store the thread location into say like a dict with the id of the device as the key, and when it finishes you delete the item from the dict.

you really don't want to be telling a device to do something then something completely different and so on and so forth. you get some pretty kewl lighting anomalies but typically people don't want the whole house turning into a disco.

now you have a means to see if something is processing on that device before you try and send a different command to it. i coded the vera plugin for lighting control it's an interesting coding project to make sure you can get around it. but it would allow alot of really cool lighting effects because of the use of the colors. whole light shows could be made.

thought for an addition.

add an action that works like the EG Python Script or the EG Python command. to allow for people to directly access the code in your script. to make said lighting effects possible without having to have all the overhead of the event\action route

you would have to use the exec function and make it limited to only the parameters for changing color, speed, direction, starting and stopping of the thread for a single device.


nice thing is the way i have it is so that if there is a ramp processing taking place and say you want to shut the lights off in the middle of that process.

it looks and sees there is one running, then joins the thread. stops the ramp delets the item in the dict then goes about with the new command you set for that device (wether it be another ramp or turning it on or off to a set point.

now with yours i would store the color you set in the actual thread. that way if someone wants to change the color you can join the thread and set the variable to a different color while the thread is running.

that would be really neat because you could do a rolling color change as the thing is turning on or off.
this is on the todo list for the vera plugin but having the ability to change ramp speeds while the ramp is taking place.

example:
have it start off really slow, and as some time passes start making it alittle faster each time. it actually makes for a really smooth looking ramp function if ya do that.
If you like the work I have been doing then feel free to Image

skribb
Experienced User
Posts: 157
Joined: Thu Feb 12, 2015 7:22 pm
Location: Win7 64bit

Re: Mi-Light Plug-in

Post by skribb » Sun Oct 02, 2016 9:43 pm

I'd really like to be able to get some LED RGB strips and control them from Eventghost, which ones are best/cheapest?

Also is it possible to control all strips at once instead of strip-by-strip?


thanks :D :D
Automation is life.

Win7 64bit
EG: r1722

zintap
Posts: 1
Joined: Wed Oct 05, 2016 6:53 am

Re: Mi-Light Plug-in

Post by zintap » Wed Oct 05, 2016 6:59 am

you have done a great job.....good luck
Graduated from Soran University with First Class Degree with Honours in Computer Science.

shayno
Posts: 9
Joined: Sun Nov 13, 2016 8:41 am

Re: Mi-Light Plug-in

Post by shayno » Sun Jul 23, 2017 6:12 am

Thanks heaps for this useful plugin,. Are you planning on adding support for the White bulbs at all?

Post Reply