Hi I am new to the forum and to Openhab.
I purchased some milight RGBW bulbs and got an ibox and found that existing milight apps were mot working.
So I started writing some java code and have tested it on windows an Ubuntu.
In openhab I created the following:-
Switch Study_Light_ON_OFF “Study_Light_ON_OFF” (Light) { exec=“ON:java -jar /usr/share/openhab/milight.jar 10.0.0.10 01 on, OFF:java -jar /usr/share/openhab/milight.jar 192.168.1.1 01 off” }
and in the sitemap created:-
Switch item=Study_Light_ON_OFF
I then created some rules for Kodi as follows:-
When kodi is playing Lights are off
When kodi is paused Lights 50% brightness
When kodi is stopped Lights are on
So far it is working ok, not allot of testing done.
I would like to contribute and if anyone is interested I am happy to share the code.
The full API isn’t implemented only the following:-
on
off
nightLight
warmWhiteLight
coolWhiteLight
color [0 - 255]
red
green
blue
brightness [0 - 100%]
brightness100
brightness50
brightness25
brightness0
discoMode1
discoMode2
discoMode3
discoMode4
discoMode5
discoMode6
discoMode7
discoMode8
discoMode5
discoModeSpeedDecreese
discoModeSpeedIncrease
iboxon
iboxoff
The discovery and setting up the zones needs to be done with the milight mobile app first.
I know that this thread is quite long but it is actually about extending the current milight binding and not about a “hacky” way to make it somehow work
At the moment I’m stuck with controlling the color bulbs (RGBWW). Apparently I’m sending wrong or not complete commands, but I’m quite sure I’m doing it exactly like other implementations or the documentation.
please use this extended tool for recording the milight communication and provide all protocol details to help me finish this binding. record_milight_v4.jar.pdf (15.4 KB)
Execute it like this:
java -jar record_milight_v4.jar
Description:
This tool emulates a milight brigde (iBox). You can run it on any java capable device as long as it is in the same network as your original plugged in iBox. We need to make the official app to add this fake milight bridge to finally send all its commands via this fake, software emulated bridge. The tool will route all app commands to the real bridge and send the responses back to the app. It is not enough to just run this tool passively, it really needs to intercept the communication.
All intercepted traffic is written to milight.txt.
The only other idea that I have is to open a VPN to allow me to develop the binding with a real bridge or @Domenic_LaRocca developing a simpler java based version, where I can copy the missing protocol parts.
I ran the new version this morning. I followed the same command list I sent last time with about 10 seconds in between. Here is the resulting log.
The commands stopped being sent some time around Zone 1 saturation. I finished off the Zone 1 commands, but then went back to the bridge status page on the app, and it appears the “spoofed” one is offline. Not sure if the java crashed or not. So I did not send the rest. However, the Power on/off and brightness commands worked correctly.
Side note, I still cannot access the openhab site….
I have this error when i execute java- jar record_milight_v4.jar
...
If there is a white bulb mode in the app, switch to that one and repeat all steps
Thank you for your help
java.net.SocketException: already bound
at java.net.DatagramSocket.bind(DatagramSocket.java:376)
at testing_delete.Main.start(Main.java:80)
at testing_delete.Main.main(Main.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
this Week-end I try to find how i can dump the communication, between the app and my Ibox, with Wireshark
I have a new built available which incorporates some improvements for the initial bridge<–>binding session handshake. This mimics the behavior of the official app and is unfortunately not documented on their developer website. I double checked the commands for on/off, whitemode and color and they are of the same structure like in the binding already. As far as I understood everyone, the iBox bulb was working anyways, so it is mainly about getting the rgbww and rgbw bulbs to react now.
Please only report behavior failures, exceptions and error messages from the log from now on. I do not need the full logs anymore. And thank you all for the help.
Observations
All devices continue to shot a status of offline. Despite just being discovered and imported. They do continue to function though.
iBox -working the same.
Color change is working, but unreliable in it’s response.
RGBW: no function at all.
Can’t help with any logs as there are no errors in the log.
Thanks Duncan
EDIT: Also, there is no ability to change the iBox to white. Any ideas?
I’m capturing the packets from my phone to the ibox that control my RGBW’s.
EDIT2: I’ve captured some traffic from my app to the iBox.
They are in my usual share location under file c1 and c2.
I did the following all on Zone 1.
Set to White
Adjusted brightness to 100%
Brightness to 50%
Brightness to 0%
Brightness to 50%
Color changes: Green, Blue, Red
Hope this helps.
so far we got control over the ibox and rgbw bulbs, awesome. and yes the way of how the color command works is different to the old brigde and i have no idea which bulb color the color wheel value of 0 represents.
it could help if someone could tell me the bulb color when the color slider is pn the very left and very right.
thanks @Duncan_Pullen for the data, as far as i know there is no white channel support for the ibox. i will have a look later. @Keije please provide your wireshark as well, ideally it is kind of commented. i prefer pastepin or github gist or gdrive for this data if possible.
have you tried to increase the repeat value for commands in the brigde configuration? if commands not always respond that might be because of radio interferences in your setup. the default value is 1, so commands are send only once.
Thanks for beta12. Big improvement in understanding paper ui controls for iBox and rgbww, see screen shot image
dual white under rgbww zone 4 appear to now work fine
iBox findings re slider and off/on switches
colour temp has no effect - light stays the same colour
brightness - works
saturation has no effect
colour bar is really strange and even the colour legend appears to repeat itself. For example here is one light colour sequence starting at left lime green for L to Mid, pink at R, R to M light blue then M to L pink, L to M orange, and lime green coming back to pink
brightness works
saturation no change
animation appears to work with full spectrum of colours, stopping animation was a matter of keep clicking until something worked
rgbww lights in zone 2 findings re slider and off/on switches
colour temp changes from yellow to white
brightness works
colour slider appeared not to work until I changed the lower saturation slider (Left gave more saturation and R the very weak colours). With saturation set to the Left the colour slider gave the following
L red 1/4 orange 1/2 lime green 3/4 to R strange blue to red, a bit like the colour legend
brightness slider works
animation appears to work with the full spectrum of colours. Managed to stop animation by using the colour temp on/off switch
Thank you for all your work on this binding
Here are a view whireshark logs. I made some comments in them. beta12 is without comments but maybe you do something with it. I also see some traffic on UDP port 48899.
Another thing is I have to manually add the ibox, I do also have a older milight bridge (see pictures) which was detected via discovery. But this one does not show up either.
Ibox starts change color when the slider is half way turns from light green -> yellow (slider light blue)->red(slider dark blue)->purple(slider purple)->blue(slider red) Blue is now the sliders most right color
Well, I think I’ve worked out why I’m having issues.
I’ve just launched the Limetless v6 Windows App and it does not change my lights, i can’t link a light. Nothing. It sees my bridge, can get the config, but that’s about it.
The Android app works as expected.
I’ve got some troubleshooting to do from my end clearly.
Thanks Duncan