Xiaomi Yeelight E27 bulb component

@mikeser homeassistant detects these bulbs automatically as long as they are in the same network. When not, you can set the IP as shown in the documentation.

@Thorbeen that is not a bug in the yeelight component but in homeassistant. You should report it separately in the bug tracker if there is no issue for this already.

Unfortunately having a new issue after rebooting HAss

17-03-07 16:52:44 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform yeelight
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/yeelight.py”, line 87, in setup_platform
add_devices(lights, True) # true to request an update before adding.
File “/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py”, line 305, in add_entities
entity.update()
File “/usr/local/lib/python3.4/dist-packages/homeassistant/components/light/yeelight.py”, line 216, in update
self._rgb = self._get_rgb_from_properties()
File “/usr/local/lib/python3.4/dist-packages/homeassistant/components/light/yeelight.py”, line 156, in _get_rgb_from_properties
return colorsys.hsv_to_rgb(hue, sat, val)
File “/usr/lib/python3.4/colorsys.py”, line 146, in hsv_to_rgb
i = int(h
6.0) # XXX assume int() truncates!
TypeError: can’t multiply sequence by non-int of type ‘float’

Any ideas?

Looks like the bulb is in hsv mode, and for some reason the properties are not floats or ints but a sequence… Can you please enable the debug logging for “yeelight” in your config and copy&paste what type of responses the bulb is sending you?

Something similar to this should work:

logger:
  logs:
    yeelight: debug

After rebooting the problem was gone…

Just enabled the debugging to make sure providing the needed code the next time the error occures.

Thanks a lot

Edit:

Another question, does anyone know the maximum transition time for yeelight?

Ok, if you locate how to enable the hsv mode instead of color temperature or RGB, you’ll probably encounter it soon enough again.

During my tests the white bulb did not turn on anymore with 10s transition, haven’t tested it out with RGB one, but if you do please update the documentation.

I was surprised how much traffic these bulbs create across my network. They are pretty much constantly communicating with the sever back in China (I think you can setup on a server in Korea too).

Setting up a firewall rule to block their traffic (inbound and outbound) killed all that traffic. Side effect is the yeelight app no longer works as the bulb -> server -> app connection is broken by the firewall rule. However, the local control by Home Assistant is unaffected.

If you don’t use the app after setup it would be worthwhile only allow connectivity to your local network only. With millions of devices being added as we pursue smart homes and the horrible security and firmware in these devices they are being hacked regularly and used in DDOS attacks. This is also one less link into your network from the outside.

1 Like

it doesnt for me. What should i do so ha can discover the lights ?

1 Like

@teprrr Sorry for the delay. When I enable the music mode I get below error messages to log. Only switching on/off works, adjusting brightness doesn’t work at all in music mode. But since there’s not that many similar complaints in here, maybe it’s just me or my setup…

[details=Summary]17-03-12 00:51:26 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 233, in _step
result = coro.throw(exc)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/core.py”, line 1001, in _event_to_service_call
yield from service_handler.func(service_call)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/init.py”, line 249, in async_handle_light_service
yield from light.async_turn_on(**params)
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/yeelight.py”, line 298, in turn_on
self.set_music_mode(self.config[CONF_MODE_MUSIC])
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/light/yeelight.py”, line 196, in set_music_mode
self._bulb.start_music()
File “/home/homeassistant/.homeassistant/deps/yeelight/main.py”, line 486, in start_music
self.send_command(“set_music”, [1, local_ip, port])
File “/home/homeassistant/.homeassistant/deps/yeelight/main.py”, line 313, in send_command
raise BulbException(response[“error”])
yeelight.main.BulbException: {‘code’: -1, ‘message’: ‘method not supported’}[/details]

@brthrsam looks like your bulb does not support the music mode at all (“method not supported”). Could you please create a bug report in issue tracker and include the error there too? Please add also which model of bulb and which firmware version it is running.

@mikeser you can try from console if netdisco detects those with python3 -m netdisco dump. Do you have discovery module enabled in homeassistant’s config? Does it work if you define IPs manually?

I didnt have netdisco installed but i installed it tried the command that you gave me and it only finds my plex server and a dlna server . Not the bulb . Also for the auto discovery should i define in the config the current ip of the bulb ?

The bulb is then not in the same network or firewall is blocking the connection. Are you sure they are in the same network? Do you know their IPs? Is the developer mode enabled?

When discovery is working, there is no need to know the IP, that’s the whole idea of it.

They are on the same network i see the bulb on the router . I am using them right now but i have to manually enter in the config the ip adress. I am new to homeassistant but i am trying to find on google how to get discovery to work without any success. Also it doesnt find my chromecast

There is the way to group two bulbs and control they as one under HA?

Is it just my Yeelight RGBW bulbs are buzzing when brightness is set above 60-70%?

Mine had the same issue…

Due to unstable network, I sold the Yeelights recently and went to Philips Hue…

I have little problem with Yeelight YLDP02YL bulb. When I restart HA when bulb is not powered I have in log

17-03-16 14:46:30 ERROR (Thread-8) [homeassistant.components.light.yeelight] Failed to connect to bulb 192.178.2.10, yeelight color bulb salon: A socket error occurred when sending the command.

and when I powered bulbs I can’t control it from HA. Only brightness changes work. Changes color and color temp don’t work.
Any solution for that?

I try this kind of configuration : http://pastebin.com/5f8di0i5

But this doesn’t give any “global control” over my 3 bulbs.
Does I miss something ?