Update Limitlessled/Milight Component V6 Bridge (iBox)

I guess the session expire and need to be renewed. In the library that’s only done by object creation. The library should maybe be extended to react properly on expired session.

For the person who is working on the library, don’t forget to reset the Sequence Number to 0 when it passed 255. Otherwise you are only able to send 255 commands.

self._sn = (self._sn + 1) % 256

The modulo 256 here already take care of that, or did you meant something else?
Edit: was corrected according to your comment before I checked :grin:

This was added just 9 hours ago, it wasn’t there when Global commented :slight_smile: . Backward compatibility should be working fine, you just have to define your bridge version. v6 is default, but you can overwrite it. I tested the library, and so far the RGBW lights and RGBWW lights work great. I added a pull request for the saturation of the new RGBWW lights, and once that is merged I think we’re almost there.

1 Like

That’s great news :slight_smile:
The problem of expiring session have also been corrected.

EDIT:
I don’t know if that was already the case before but I see that if the bridge is not reachable (v6), home-assistant start will hang at “Setting up light.limitlessled”.
I guess that the refresh of session ID will also have to be handle in case of deconnection/restart of the bridge. Keep-alive might not be enough in that case.
Another point: If the bridge (iBox) is restarted, the control is lost until home-assistant is restarted.

Is there a way to extend the milight functionality to include “modes” like discomode? I know the old LimitlessLED api allowed it but the home assistant module did not include it.

1 Like

The problem is that within the light element nothing allow for such a mode to be triggered as far as I know. I guess that would have to be handled as a separate entity like hue scene.
You could open a separate feature request. It’s better if this thread focus on the implementation and not mix other feature request in within.

What a great results! Good work guys!

I’m pretty new with the way home assistant components will be updated. Can I wait for the final update? And is it an automated process? Or should I do it manually with the fork as described above?

Once tested, that fork will probably be merged into the python-limitlessled repository. Then a new limitlessled release will be published to pypi, and then the home assistant dependency version number set to that new release, and Home Assistant documentation updated accordingly.

So if you wait a bit, you will have to do nothing but upgrade Home Assistant and read the new documentation.

Any idea when that might be?

I don’t know how long testing will take. It is up to the testers and developers.

Home Assistant is normally on two-week release cycle, so it could take up to two weeks from a merge of tested code.

I’m able to get the bridge light to work using the config posted above, but I can’t get any of the associated rgbww lights to work. Anytime I add a light group homeassistant hangs on startup trying to setup limitless led. I don’t get any error. Here is my config:

light:
  platform: limitlessled
  bridges:
    - host: 192.168.86.159
      version: 6
      port: 5987
      groups:
      - number: 1
        name: bridge
        type: bridge-led
      - number: 1
        name: lr
        type: rgbww

@alexmat, should be good. Did you update your /usr/local/lib/python3.4/dist-packages/homeassistant/components/light/limitlessled.py with the new led-types?

I got this working in HA. However, after some time all commands stop working. Another thing is that we should be able to specify the default color-temperature for rgbww lights. When I turn it on now, it is the coldest temperature, while I would like the most warm color to be automatically set.

Which bulb do you use? Most bulb on the market are rgbw, the rgbww is still very rare (and can only be ordered directly from limitlessled as far as I know)

Normally they was a fix for that, are you sure to be using the latest version of the fork (with keep-alive implemented?).
And hass refuse to start if the bridge is missing/does not answer, that might be a problem.

I use the new bulbs, with RGB, cold white leds and warm white leds. I’m sure that I am using the latest version. I will place some logging in the limitlessled module to see where it goes wrong. I think it loses the connection and doesn’t reconnect.

I will look into it this evening :slight_smile:

@touliloup It is the rgbww bulbs. I bought them directly from limitlessled. Trying to use them hard locks homeassistant and I have to restart it.

@alexmat, did you update your /usr/local/lib/python3.4/dist-packages/homeassistant/components/light/limitlessled.py with the new led-types?

@ashwin I installed homeassistant in a virtual environment by following the official manual install guide. I installed the updated limitless led package in the virtual environment and got this response:

(homeassistant_venv) homeassistant@hass:/srv/homeassistant/homeassistant_venv/python-limitlessled-master $ python3 setup.py install

...

Installed /srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/limitlessled-1.0.2-py3.4.egg
Processing dependencies for limitlessled==1.0.2
Finished processing dependencies for limitlessled==1.0.2

I then edited the homeassistant limitlessled file:

(homeassistant_venv) homeassistant@hass:/srv/homeassistant/homeassistant_venv $ vim lib/python3.4/site-packages/homeassistant/components/light/limitlessled.py

and made the necessary changes:

...

DEFAULT_LED_TYPE = 'rgbw'
DEFAULT_PORT = 5987
DEFAULT_TRANSITION = 0
DEFAULT_VERSION = 6

LED_TYPE = ['rgbw', 'white', 'rgbww', 'bridge-led']

...

This works for the bridge led, but if I add any rgbww bulbs to the config it locks up homeassistant on restart.

Hi All,

I’ve been testing Homeassistant as a replacement for Smartthings. I have the new Milight iBox with 2 new rgbww 16 million colour bulbs and i’m keen to finish my testing before I completely adopt Homeassistant.

My test bed is on a windows machine, as I thought before I go and spend any more on a Raspberry Pi or equivalent I would make sure I could get the Milight integration working. I attempted to make the changes and update components but I am receiving some errors I have no idea as the n00b I am to fix but I am also keen to learn from what the answer is to make sure I can use the platform properly.

Cutting my life story short my Errors are:

17-01-08 17:14:11 homeassistant.components.light: Error while setting up platform limitlessled

Traceback (most recent call last):

File “C:\Program Files\Python35\lib\site-packages\homeassistant\helpers\entity_component.py”, line 150, in _async_setup_platform

entity_platform.add_entities, discovery_info

File “C:\Program Files\Python35\lib\asyncio\futures.py”, line 361, in iter

yield self  # This tells Task to wait for completion.

File “C:\Program Files\Python35\lib\asyncio\tasks.py”, line 296, in _wakeup

future.result()

File “C:\Program Files\Python35\lib\asyncio\futures.py”, line 274, in result

raise self._exception

File “C:\Program Files\Python35\lib\concurrent\futures\thread.py”, line 55, in run

result = self.fn(*self.args, **self.kwargs)

File “C:\Program Files\Python35\lib\site-packages\homeassistant\components\light\limitlessled.py”, line 110, in setup_platform

group_conf.get(CONF_TYPE, DEFAULT_LED_TYPE))

File “C:\Users\Livingroom\AppData\Roaming.homeassistant\deps\limitlessled\bridge.py”, line 86, in add_group

group = group_factory(self, number, name, led_type)

File “C:\Users\Livingroom\AppData\Roaming.homeassistant\deps\limitlessled\bridge.py”, line 34, in group_factory

raise ValueError('Invalid LED type: %s', led_type)

ValueError: (‘Invalid LED type: %s’, ‘rgbww’)

Any help be much appreciated, I don’t want to pour anymore money into smartthings and I want to stop handing over £30-£50 quid on bulbs, when in reality I like the Milight bulb brightness etc better.

Thanks
Paul