Mi_light Ibox v6 (API) not working

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post
Post Reply
cverhoef
Posts: 26
Joined: Sunday 13 November 2016 12:03
Target OS: Linux
Domoticz version: Dev
Contact:

Mi_light Ibox v6 (API) not working

Post by cverhoef » Sunday 13 November 2016 12:33

Hi,

Domoticz Version: 3.5877
Build Hash: 15b013c
Platform: Armbian 5.23

Description:
I'm just started with domoticz and try to add my Mi-Light configuration to it. For this I'm using the ibox with v6 API with my CW WW bulb's grouping on it in the 4 groups. This setup is working very well from the mi-light app but will not work with domoticz.
I think it has to do with the current implementation which is maybe not v6 (http://www.limitlessled.com/dev/) compatible at the moment, or do I something wrong?

Setup is adding hardware Limitless with modesetup White (but also tried RGBW and RGB), this give me 10 devices. 5 White en and 5 Color, none of them are working. IP adres and port number are correct, checked at the ibox itself.

Regards,
Chris

Nautilus
Posts: 638
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by Nautilus » Sunday 13 November 2016 13:12

Yes, this is correct that the new API is not (yet) supported in Domoticz. I think it was just recently released (dated 12.11. in Limitlessled site). Just have to wait and see if someone will take a look at this :) I can confirm that even the new type's of bulbs are also controllable with the old bridge (v5 at least). Changing the saturation, though, needs an extra switch and a bit of an effort with Lua (and it only changes it up or down, not to specific value).
Last edited by Nautilus on Sunday 13 November 2016 20:45, edited 1 time in total.

cverhoef
Posts: 26
Joined: Sunday 13 November 2016 12:03
Target OS: Linux
Domoticz version: Dev
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by cverhoef » Sunday 13 November 2016 15:59

Thanks, then I have two options: wait or try to help.
Let's try to help, I will search for the developer of the current code and see if I can provide any help (I'm not a real coder, but who knows)

User avatar
gizmocuz
Posts: 8491
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by gizmocuz » Monday 14 November 2016 8:57

I Guess this new API is not working for the old users ? Is it working with the old wifi bridge, can this be updated, or do users need to buy a new one ?
The API looks totally different, i must say, good job on backwards compatibility ! ;)
Quality outlives Quantity!

cverhoef
Posts: 26
Joined: Sunday 13 November 2016 12:03
Target OS: Linux
Domoticz version: Dev
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by cverhoef » Monday 14 November 2016 19:31

@gizmocuz, I only have an ibox(bridge) with v6 API on it, so I'm not able to test if this API is working on a v4/5 bridge to confirm your question.
If i'm correct you are one of the maintainers of the Limitless.cpp code. Is there a way in which I can help?

Nautilus
Posts: 638
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi
Domoticz version: beta
Location: Finland
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by Nautilus » Monday 14 November 2016 23:51

I think the old bridges will stay as they are, not possible to update to v6 API. Controlling the "new" RGB+CCT bulbs works in a decent way also with the older API (v5 at least). Saturation cannot be set into any discrete value, it can be controlled however in steps of 10% by S+ and S- (program speed up or down). So, to be able to really set the new bulbs to certain color / dimming / saturation combination also the "old users" would need Domoticz to support the v6 API - and then of course to purchase the new iBox1 or iBox2. And in case you only have the new iBox, then there's currently no way (that I'm aware of) to integrate the lights to Domoticz.

cverhoef
Posts: 26
Joined: Sunday 13 November 2016 12:03
Target OS: Linux
Domoticz version: Dev
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by cverhoef » Sunday 20 November 2016 20:26

I’m trying to talk to the v6 API with nc from my fedora host to learn working with the API and hopefully use the hardware plugin implementation using V5 API within Domoticz as a start to write the V6 hardware plugin. But unfortunately I’m not able to get the Ibox1 do any work from send UDP messages from my fedora host. I asked some support from Limitlessled but they didn’t answer my email at the moment. Hopefully someone on this forum could help me further.

For test I try to switch off the Ibox Bridge light and because I dont’ know the WifiBridgeID I’m using a very basis and straightforward for loop to try every ID which could be possible.

for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do x="\x80\x00\x00\x00\x11\x"$i$j"\x00\x00\x01\x00\x31\x00\x00\x00\x03\x04\x00\x00\x00\x01\x00\x39"; echo -n -e $x|nc -u <IP> 5987; echo $i$j; sleep 1; done; done

The response I get from the Ibox on every UDP message is 88 00 00 00 03 00 {Seq#}11 instead of 88 00 00 00 03 00 {Seq#}00 and the action is not taken. What am I missing here?

Regards,
Chris

DanielT
Posts: 4
Joined: Monday 28 November 2016 4:01
Target OS: Linux
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by DanielT » Monday 28 November 2016 4:16

From my testing the "WifiBridgeID" isn't static for a given gateway and increments (0x00-0xFF) every second. Once a converstation starts then that conversation keeps using the same WB code.

Here's a snapshot of a conversation between app and Bridge that I captured this morning

Lines with @ come from the app, and % from the Bridge, in this capture, the Bridge ID is 0x84 (in bold), which I thing needs to be captured in response to the first query, I've also bolded the bridge mac address. Each time I've captured this conversation the BridgeID has been different.

@200000001602623ad5eda301ae082d466141a7f6dcafde7b00001e
% 28000000110002accf23f5813269f04c180001840000

@80000000118400000b00330000000000000000000033
%8800000003000b00
%8000000015accf23f58132050200340000000000000000000034

#zone 1 on
@80000000118400000c0031000008040100000001003f
%8800000003000c00
#zone 1 off
@80000000118400000d00310000080402000000010040
%8800000003000d00

epocapp
Posts: 4
Joined: Thursday 01 December 2016 8:18
Target OS: Windows
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by epocapp » Thursday 01 December 2016 8:23

I'm the developer of http://www.epocapp.eu/milight.
I'm having the same problems with the new bridge. So far LimitlessLed has not been of any help.
Last edited by epocapp on Monday 10 April 2017 9:33, edited 1 time in total.

DanielT
Posts: 4
Joined: Monday 28 November 2016 4:01
Target OS: Linux
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by DanielT » Saturday 03 December 2016 3:39

I've successfully obtained API control over my v6 bridge and RGBW lights (probably RGBWW as well but I haven't tested thoroughly) through some NodeJS scripts. It's rudimentary and has some quirks, but it 'works for me'. https://github.com/Daniel-t/milightplayground

The biggest quirk for me at this stage is that I have to bind to the local port 'UDP/5987' as well as connect to the bridge on UDP/5987. This shouldn't be necessary and was only done originally by mistake, cleaning up the code broke it.

I think I've captured the protocol fairly completely as well so hopefully there's enough information there to help someone else with the Domoticz plugins.

Things I learnt, there's a handshake at the start of a connection in which a consumer reserves a 'Bridge ID' these rotate every second otherwise, once you've reserved the ID, you need to send keepalive requests ~20 seconds or so (haven't hunted the precise value down) or the 'reservation' lapses and you need to reserve a new ID.

epocapp
Posts: 4
Joined: Thursday 01 December 2016 8:18
Target OS: Windows
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by epocapp » Sunday 04 December 2016 10:59

Nice work Daniel!
Can you please explain a bit more what is the process for reserving the bridge id? What about the sequence number?

DanielT
Posts: 4
Joined: Monday 28 November 2016 4:01
Target OS: Linux
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by DanielT » Sunday 04 December 2016 12:35

As far as I can tell (and I know there are gaps in what I've worked out)...

The sequence number is easy, I suspect its completely arbitrary, pick a value between 0x00 and 0xFF and increment for each command you send. I suspect that incrementing might not be necessary just convenient so that you can identify the return packet for a specific command.

The bridge ID is harder, and I'm not sure I have a full picture. However here's what works for me at present:

Sending this to the bridge (on UDP/5987):

Code: Select all

200000001602623ad5eda301ae082d466141a7f6dcafde7b00001e
gives this reply (yours will vary slightly

Code: Select all

28000000110002[i]accf23f58132[/i]69f04c180001[b]84[/b]0000
The italicised section is the Bridge's mac address, and the bold is the "Bridge ID", the byte offsets always seem to be the same (for me anyway).

Following that I send

Code: Select all

8000000011[b]84[/b]00000b00330000000000000000000033
substituting the BridgeID from the previous step.

After this it appears that I can send commands as per the documentation on http://www.limitlessled.com/dev

If you're not actively using a BridgeID it appears to timeout after a little while, which is why there are keepalives in the API docs.

My git repository now also has a very rough Node Red node in case anyone wants to give it a go. Note this is problematic. If you 'redeploy' the node after creation it seems to stop working until node-red is restarted. However it is at least partially functional as I've used it in a couple of test flows.

cverhoef
Posts: 26
Joined: Sunday 13 November 2016 12:03
Target OS: Linux
Domoticz version: Dev
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by cverhoef » Monday 05 December 2016 8:52

Good job Daniel,
Yesterday I have had some answers from Limedlessled. They have updated the API description on http://www.limitlessled.com/dev/ and will add some code examples this week.

mitrou
Posts: 1
Joined: Tuesday 29 November 2016 8:07
Target OS: Windows
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by mitrou » Tuesday 06 December 2016 7:36

Thank you Daniel.
That's pretty much what Limitlessled told me too, they said they'll post some examples in the weekend

DanielT
Posts: 4
Joined: Monday 28 November 2016 4:01
Target OS: Linux
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by DanielT » Tuesday 06 December 2016 12:02

I've been in touch with the LimitlessLed people as well, they've updated the documentation at http://limitlessled.com/dev and filled in a few blanks.
Key things:
- Confirmation that the BridgeID is more of a session identifier than a Bridge Identifier
- The BridgeID is two bytes, not one. This was causing me intermittent issues.

The milight.js file in my repository has my current working library.

deennoo
Posts: 897
Joined: Wednesday 10 December 2014 14:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by deennoo » Tuesday 06 December 2016 12:53

Got a v6 too.

Got to make it work with another HA app (v6 bridge + old rgbw bulb).

If i can help
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / ESP8266 / MQTT / BLE
http://domo-attitude.fr

kasabian
Posts: 1
Joined: Saturday 17 December 2016 21:34
Target OS: Windows
Domoticz version:
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by kasabian » Saturday 17 December 2016 21:35


deennoo
Posts: 897
Joined: Wednesday 10 December 2014 14:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by deennoo » Saturday 17 December 2016 21:59

Not really...sorry dud

Limitless already provid an exe tool to drive this....Jeedom already got a Working plugin.

2 choice for us : waiting for a real c++ integration or having a python plugin (feature will be aviable soon)
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / ESP8266 / MQTT / BLE
http://domo-attitude.fr

User avatar
gizmocuz
Posts: 8491
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi
Domoticz version: beta
Location: Top of the world
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by gizmocuz » Sunday 18 December 2016 9:58

This is an opensource project.
I am not going to integrate this soon, got to many other things to do at the moment, so hopefully there is an other developer willing to add this
I also do not have the hardware, but the old hardware, and i find it really bad they screwed up the API to make it not compatible with the old system.
They force people to buy new stuff

Sure, another option is to just buy other hardware?
Quality outlives Quantity!

deennoo
Posts: 897
Joined: Wednesday 10 December 2014 14:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Mi_light Ibox v6 (API) not working

Post by deennoo » Friday 23 December 2016 1:25

DanielT wrote:I've been in touch with the LimitlessLed people as well, they've updated the documentation at http://limitlessled.com/dev and filled in a few blanks.
Key things:
- Confirmation that the BridgeID is more of a session identifier than a Bridge Identifier
- The BridgeID is two bytes, not one. This was causing me intermittent issues.

The milight.js file in my repository has my current working library.
Please can you give some exemple about how to use your lib ? with a python script who call your .js lib ? using the new plugin section for Domoticz can be possible ?
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / ESP8266 / MQTT / BLE
http://domo-attitude.fr

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests