Update Limitlessled/Milight Component V6 Bridge (iBox)

I am still not giving up. But a step closer I think.

I removed the limitlessled files from /home/homeassistan/.homeassistant/debs.
When I restarted HASS, it said that it was installing 1.0.3 version of limitlessled. That is good, I think. But now I get the following error:

17-01-20 21:55:29 homeassistant.loader: Loaded light.limitlessled from homeassistant.components.light.limitlessled
17-01-20 21:55:29 homeassistant.bootstrap: Setting up light
17-01-20 21:55:29 homeassistant.components.light: Setting up light.limitlessled
17-01-20 21:55:29 homeassistant.components.light: Error while setting up platform limitlessled
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py”, line 151, in asyncsetup_platform
entity_platform.add_entities, discovery_info
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/limitlessled.py”, line 111, in setup_platform
lights.append(LimitlessLEDGroup.factory(group))
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/limitlessled.py”, line 164, in factory
return LimitlessLEDWhiteGroup(group)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/limitlessled.py”, line 203, in init
self.group.temperature = 1.0
File “/srv/homeassistant/lib/python3.4/site-packages/limitlessled/group/white.py”, line 62, in temperature
self.totemperature)
File “/srv/homeassistant/lib/python3.4/site-packages/limitlessled/group/white.py”, line 140, in _setter
top()
File “/srv/homeassistant/lib/python3.4/site-packages/limitlessled/group/init.py”, line 35, in wrapper
function(self, *args, **kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/limitlessled/group/white.py”, line 198, in _warmest
self._warmer()
File “/srv/homeassistant/lib/python3.4/site-packages/limitlessled/group/white.py”, line 217, in _warmer
self.send(self.command_set.warmer())
AttributeError: ‘CommandSetWhiteV6’ object has no attribute ‘warmer’

I tried to take a step back. I wrote my own simple script in python that uses this library. When I let it send to my PC I can see the messages. But when I send it to the hub I see nothing. I am still using wireshark to do this.

Can anyone help me? Also, does anyone know when support for the V6 will officially be added to HASS?

It isn’t ready for a release yet, there are still features that aren’t working…

When I add a light that has the type “white”, limitlessled crashes:

17-01-26 13:23:26 homeassistant.components.light: Error while setting up platform limitlessled
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/light/limitlessled.py", line 116, in setup_platform
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/light/limitlessled.py", line 174, in factory
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/light/limitlessled.py", line 250, in __init__
  File "/home/domotica/python-limitlessled/limitlessled/group/__init__.py", line 83, in on
  File "/home/domotica/python-limitlessled/limitlessled/group/commands/v6.py", line 141, in off
  File "/home/domotica/python-limitlessled/limitlessled/group/commands/v6.py", line 112, in _build_command
  File "/home/domotica/python-limitlessled/limitlessled/group/commands/__init__.py", line 43, in __init__

Anyone has any clue why this isn’t working?

I see the same thing when I try to add a White type. I was wondering, when you add a white light bulb as rgbw in HASS, can you turn it on/off?

This doesn’t have anything to do with the library, you have to make some change in Home-Assistant to adapt the new library… thus the error you are seeing.

This file need to be modified: /usr/local/lib/python3.5/dist-packages/homeassistant/components/light/limitlessled.py

Anyway as long as the python library new version is not published/finish, no change can occur in home-assistant.

But white was also in the default limitlessled.py.

I still have the following issue when adding white instead of rgbw. Rgbw doen’t give any errors, but white does. Very strange.

I received my new V6 milight bits the other day, and managed to get it all working thanks to all the info in this thread - thanks everyone!

I used the modified limitlessled.py file provided by @ashwin above, but I’ve made a few additional modifications to get colour temperature working as well. My updated version is below if it’s useful to anyone :

Changes from @ashwin version :

  • Added temperature variables to class LimitlessLEDRGBWWGroup definition (copying from class LimitlessLEDWhiteGroup), and set default temperature to 0.5 (mid white)
  • Line 351-355 - add a check to see if colour is white, and if it is to a transition to new temperature (not sure this is the best way of doing this - but the limitlessled library won’t support a transition to colour and temperature at the same time, so I had to separate this out to a different operation from the colour transition)

http://pastebin.com/tDz8wWsW

5 Likes

Your code works great! I haven’t done that much with Python either, so maybe there is someone with more experience who would want to look into it?

I’m using this new version “in production” at home, and so far it never failed me. No lost connections or weird behaviour.

If this helps anyone, I am using the Hassbian build and couldn’t get the limitessled fork working until I forced the python3 install into the /home/homeassistant/.homeassistant/deps folder.

Otherwise, I copied the updated limitlessled.py by folks above and got it working!

Hey guys,
I’m the developer of the v6 fork and just came across this thread :smiley:
@stefan85 @ashwin There was a bug when using white bulbs with a v6 bridge, which I haven’t noticed yet, because I don’t own any white bulbs. I just pushed a commit, which should fix that. Give it a try and let me know, if it works :wink:

1 Like

Hi, I will try this tonight. I finally got something working. In the milight app I binded the white lamps as white lamps (white virtual remote). This didn’t work. Then I changed it to the default rgb virtual remote and used rgbww in hass. This worked. I don’t know why, but at least it was something.

Now I still have to test your new update. But I think your changes will work. Thank you for your work. I will post an updated as soon as possible.

Are your bulb manufacture by limitlessled? Or it’s possible that the manufacturer simply used the RGB standard…

Good question, mine are Milight lamps. What I still find confusing is that I can’t monitor transmissions with wireshark. I don’t see anything. But it works, so I can’t complain :slight_smile: .

Hi guys !

I get an error when I made change over /usr/local/lib/python3.5/dist-packages/homeassistant/components/light/limitlessled.py :

17-02-10 09:41:11 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform limitlessled
Traceback (most recent call last):
File “/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity_component.py”, line 151, in _async_setup_platform
entity_platform.add_entities, discovery_info
File “/usr/lib/python3.5/asyncio/futures.py”, line 361, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 296, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 274, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.5/dist-packages/homeassistant/components/light/limitlessled.py”, line 114, in setup_platform
lights.append(LimitlessLEDGroup.factory(group))
File “/usr/local/lib/python3.5/dist-packages/homeassistant/components/light/limitlessled.py”, line 172, in factory
return LimitlessLEDRGBWGroup(group)
File “/usr/local/lib/python3.5/dist-packages/homeassistant/components/light/limitlessled.py”, line 248, in init
self.group.on = True
File “/usr/local/lib/python3.5/dist-packages/limitlessled/group/init.py”, line 83, in on
cmd = self.command_set.off()
File “/usr/local/lib/python3.5/dist-packages/limitlessled/group/commands/v6.py”, line 140, in off
return self._build_command(0x03, 0x04)
File “/usr/local/lib/python3.5/dist-packages/limitlessled/group/commands/v6.py”, line 111, in _build_command
self._group_number)
File “/usr/local/lib/python3.5/dist-packages/limitlessled/group/commands/init.py”, line 43, in init
self._bytes = bytearray(bytes)
TypeError: an integer is required

Any idea ?

Hi, I tried you new commit but I have no luck with it. It works when I select rgbww, but not white.

Traceback (most recent call last):
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py”, line 151, in _async_setup_platform
entity_platform.add_entities, discovery_info
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/limitlessled.py”, line 114, in setup_platform
lights.append(LimitlessLEDGroup.factory(group))
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/limitlessled.py”, line 168, in factory
return LimitlessLEDWhiteGroup(group)
File “/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/light/limitlessled.py”, line 209, in init
self.group.temperature = 1.0
File “/home/homeassistant/.homeassistant/deps/limitlessled/group/white.py”, line 66, in temperature
cmd = self.command_set.temperature(temperature)
File “/home/homeassistant/.homeassistant/deps/limitlessled/group/commands/v6.py”, line 215, in temperature
return self._build_command(0x05, temperature)
File “/home/homeassistant/.homeassistant/deps/limitlessled/group/commands/v6.py”, line 108, in _build_command
checksum = sum(cmd + zone_selector) & 0xFF
TypeError: unsupported operand type(s) for &: ‘float’ and ‘int’

I also tried the developers version of Home Assistant with the update. And I do have this error with my version 5 bridge:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/light/limitlessled.py", line 110, in setup_platform
version=bridge_conf.get(CONF_VERSION, DEFAULT_VERSION))
  File "/var/opt/homeassistant/deps/limitlessled/bridge.py", line 99, in __init__
self._init_connection()
  File "/var/opt/homeassistant/deps/limitlessled/bridge.py", line 206, in _init_connection
self._socket.recv_into(response)
ConnectionRefusedError: [Errno 111] Connection refused

If I only set the V6 Bridge in the configuration file, I have no problem. The v6 bridge is working well.

Has someone an idea what is going wrong?

@stefan85 Its a bug, which I just fixed on my fork. Sorry about this.

@Maxim The default port has changed to 5987. For v5 you have to set it explicitly to 8899.

Sounds like you have the same setup as me @drrayl. Can you let me know or what you mean by install python3 into the reps folder?

Then where do I find the limitlessled.py file in hassbian?

I used the updated setup.py in soldag’s build and made sure to install using python setup.py install --prefix (home assistant deps folder).

Just took a look at HASS on git and it seems the updated fork was merged. If you wait until the next build, an update should make it work without having to alter anything.

1 Like

Hi folks,

Both bugs are fixed in this PR: https://github.com/home-assistant/home-assistant/pull/6006 (v6 white temperature, v5 bridge not working)