Ole8700 / openhab

Automatically exported from code.google.com/p/openhab
GNU General Public License v3.0
1 stars 0 forks source link

Implement MiLight Binding #277

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Support MiLight bulbs, both dimmable white ones and RGB bulbs: 
www.philippinestuffs.com/milight-wifi-controlled-light-bulbs/

Original issue reported on code.google.com by kai.openhab on 6 May 2013 at 8:41

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by teichsta on 21 May 2013 at 9:41

GoogleCodeExporter commented 9 years ago
limitless (same bulb) has released the commandset
http://www.limitlessled.com/dev/

Original comment by g.g.r...@gmail.com on 22 Jun 2013 at 3:45

GoogleCodeExporter commented 9 years ago
I have interfaced with a LimitlessLED via their WIFI bridge using a simple 
Python script (attached). This is only one-way communication since there is no 
way to poll the LED and check it's status.

Here is an example of the item configuration;

Switch  LightLED  "LED"  <light>  (Lights)  { exec=">[OFF:/bin/sh@@-c@@python 
/home/ben/python/led_command.py -i '192.168.1.32' -p 50000 -c 'off'] 
>[ON:/bin/sh@@-c@@python /home/ben/python/led_command.py -i '192.168.1.32' -p 
50000 -c 'on']" }

Where the WIFI bridge is at 192.168.1.32 on port 50000.

Original comment by ben.jone...@gmail.com on 24 Jun 2013 at 12:10

Attachments:

GoogleCodeExporter commented 9 years ago
I have just started implementation of MilightBinding.
Cause it's just one way communication, it should be finished before next 
release.

Original comment by josh.m5968 on 3 Aug 2013 at 10:03

GoogleCodeExporter commented 9 years ago
Do you plan White and RGB support at the same time?

Original comment by kai.openhab on 4 Aug 2013 at 6:30

GoogleCodeExporter commented 9 years ago
Yes, that's the plan.

Original comment by josh.m5968 on 4 Aug 2013 at 8:30

GoogleCodeExporter commented 9 years ago
Cool, lokking forward to it. I have MiLights myself, so I am happy to test it 
as soon as something is available.

Original comment by kai.openhab on 4 Aug 2013 at 8:31

GoogleCodeExporter commented 9 years ago
Excellent, so stay tuned. I hope to have it ready before i start holiday in two 
weeks.

Original comment by josh.m5968 on 4 Aug 2013 at 8:49

GoogleCodeExporter commented 9 years ago
me, too - so i'd be happy to review your binding :-)

Original comment by teichsta on 5 Aug 2013 at 2:47

GoogleCodeExporter commented 9 years ago
Don't be to enthusiastic ..:-(

The Hardware desing and the api are not really good.
- rgb bulbs can only be controlled at once
- Color can be changed in 255 predefined steps, so at the Moment i have no clue 
how
  to adopt using the colorpicker
- brightnes and Color temperature can only be changes for all switched on White
  bulbs at once
- there is no real Support for percentage Inputs, so no slider will work

how can i define a item just showing up and down arrows which send increase and 
decrease commands like non webkit Browsers do ???

Original comment by josh.m5968 on 10 Aug 2013 at 6:27

GoogleCodeExporter commented 9 years ago
> how can i define a item just showing up and down arrows which send increase 
and decrease commands like non webkit Browsers do ???

use the Switch widget with mappings (see radio station sample in demo.sitemap)

Original comment by teichsta on 10 Aug 2013 at 6:36

GoogleCodeExporter commented 9 years ago
Thanks !

Just did another test with the remote control delivered thith the set and found 
a strange behaviour.

I switched white bulb on channel one ON and dimmed it to approx 50%
Then i switched White bulb on channel two on.
Now, when i try to dimm again, only bulb on channel two changes.

So, changes of brightnes and color temperature will only affect on the last 
switched single channel, or all, if you use the all on Switch.

Original comment by josh.m5968 on 10 Aug 2013 at 6:54

GoogleCodeExporter commented 9 years ago
I just pushed an initial version of the binding code, but have to admit that it 
is not working correctly.

I got stuck with the following :
The code will not read the itemType and therefore can not set the messageBytes 
to send to the milight Bridge. I tried to solve this for the last two days, but 
can not get it working.
Please have a look at the code and give me a hint.

Next Thing then ist to write instructions for sitemap and item definitions, 
cause the hint with Switch wifget with mappings does not work for me either.

Original comment by josh.m5968 on 11 Aug 2013 at 12:23

GoogleCodeExporter commented 9 years ago
Solved the Problem, binding is running apart from ColorItem.

Code is ready for Review !

Original comment by josh.m5968 on 11 Aug 2013 at 3:41

GoogleCodeExporter commented 9 years ago

Original comment by kai.openhab on 11 Aug 2013 at 10:20

GoogleCodeExporter commented 9 years ago

Original comment by teichsta on 13 Aug 2013 at 4:03

GoogleCodeExporter commented 9 years ago
Thanks Josh!
One very early review feedback: You should move the configuration of the ip and 
port of the bridge to openhab.cfg - it is not nice having to repeat this for 
all the item configurations.
Another question: You doc mentions the disco mode as well, but the 
implementation does not seem to support this yet, right?

Original comment by kai.openhab on 15 Aug 2013 at 4:43

GoogleCodeExporter commented 9 years ago
Some more feedback:
- MilightBindingConfig.commandType should be an Enum instead of a String and 
unknown values for it should be directly rejected in 
processBindingConfiguration()
- Idea for the slider support: with every INCREASE/DECREASE the binding should 
send a status update on the event bus. If there are 10 steps altogether, this 
would mean +/-10% of the current status. When receiving a PercentType command, 
you could then calculate how many times (with 100ms pause inbetween) you have 
to send dim up/down to the bridge to reach that value. Behaviour will of course 
only be approximately, but definitely better than no support.
- regarding dimming a certain bulb: I guess you will have to send an on before 
the dim command to signal which bulb you want to address. As far as I 
understand, this will not set the bulb to 100% as for this there is the "Full" 
command.
- regarding color support: I guess it would be nice to introduce a map where we 
can start with a few predefined colors to be used for certain values of the 
color picker. E.g. if the "r" value of the color picker rgb value is the 
highest, we send color id of red to milight, etc. We could have a coarse grain 
color support this way which could be improved later (and one day maps all 255 
colors correctly).

Original comment by kai.openhab on 15 Aug 2013 at 5:15

GoogleCodeExporter commented 9 years ago
Hi Kai,
Reason for having ip and port in the item configuration is the possibilitiy to 
have more than one bridge in the house.

Try to change the coding according to comment #20

Original comment by josh.m5968 on 15 Aug 2013 at 11:12

GoogleCodeExporter commented 9 years ago
If support for multiple gateways is a must, you can still move the config to 
the .cfg file, see e.g. the entries for SamsungTV or Onkyo.

Original comment by kai.openhab on 16 Aug 2013 at 8:33

GoogleCodeExporter commented 9 years ago
Short update on progress :
- commandType moved to enum
- implemented commands for dimming white bulbs individual
- added nightMode and fullBrightness
- fixed discoMode and discoSpeed

Still working on slider support.
Need a clue how to store the last percentage value to calculate the difference 
when receiving a new value. Can you help me on this ??

Last thing to implement will be color mode, not quite sure if I can manage this 
before going on vacation ...

When moving ip and port, what do you suggest how many bridges should be 
supported ?

Original comment by josh.m5968 on 16 Aug 2013 at 7:56

GoogleCodeExporter commented 9 years ago
> Need a clue how to store the last percentage value to calculate the 
difference when receiving a new value. Can you help me on this ??
The easiest would probably be to store the percentage value as an additional 
field in the MilightBindingConfig, what do you think?

> When moving ip and port, what do you suggest how many bridges should be 
supported ?
Any number. In the .cfg the user just lists as many as you like and gives them 
ids. These ids can then be referenced in the binding config. Should be done 
this way for Onkyo etc.

Original comment by kai.openhab on 16 Aug 2013 at 9:18

GoogleCodeExporter commented 9 years ago
Sorry, don't know how to use this. Do you have an example ?

Started implementing Colorpicker, color translation finished, but not working.
Binding will not check " if command instanceof HSBType "

Could you have an eye on it ?

Original comment by josh.m5968 on 17 Aug 2013 at 1:21

GoogleCodeExporter commented 9 years ago
You do not have the paranthesis right - it already went into "if 
(deviceConfig.getCommandType().equals(BindingType.rgb))", so it will never go 
through the "else if (command instanceof HSBType)" part.

An example for the .cfg is as I mentioned the Onkyo binding, see 
OnkyoBinding.update() method for an implementation.

Original comment by kai.openhab on 17 Aug 2013 at 12:17

GoogleCodeExporter commented 9 years ago
Thanks, did not see this last night.
Should have had a break earlier.

Asking for an example was not talking about the config, already working on this.
It was about adding an extra field for storing the last value to calulate the 
difference.

Original comment by josh.m5968 on 17 Aug 2013 at 1:07

GoogleCodeExporter commented 9 years ago
Moved bridge configuration to openhab.cfg (looks a bit ugly)
implementation of missing slider and rgb support is finished an tested.
WIKI page is published
Binding is ready for review and testing !!

Original comment by josh.m5968 on 18 Aug 2013 at 2:54

GoogleCodeExporter commented 9 years ago

Original comment by kai.openhab on 18 Aug 2013 at 3:57

GoogleCodeExporter commented 9 years ago
Binding has been refactored and tested, code committed with changeset 
https://code.google.com/p/openhab/source/detail?r=f1af83ad0fef8a05616de4543f3974
3b89ef9128.

Original comment by kai.openhab on 28 Aug 2013 at 8:05

GoogleCodeExporter commented 9 years ago
is there a option to controll the one-channel white bulbs too ?

Original comment by Paul.R.F...@gmail.com on 5 Feb 2014 at 9:55

GoogleCodeExporter commented 9 years ago
Hi Paul, please note, that the openHAB issue tracker has been moved to Github 
(see 
https://github.com/openhab/openhab/issues?direction=desc&milestone=1&sort=update
d&state=open). This Google-Code Tracker is no longer supported. Thanks, Thomas 
E.-E.

Original comment by teichsta on 6 Feb 2014 at 1:46