Problem with yeelight

hello, after the last update 0.116.1 i have issue with the yeelight bulb, here what is in the log:

2020-10-08 22:49:45 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Luce Camera for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 231, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 287, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 140, in async_setup_entry
    platform = await async_prepare_setup_platform(
  File "/usr/src/homeassistant/homeassistant/setup.py", line 298, in async_prepare_setup_platform
    platform = integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 401, in get_platform
    cache[full_name] = importlib.import_module(
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/yeelight/light.py", line 140, in <module>
    EFFECT_RANDOM_LOOP: yee_transitions.randomloop,
AttributeError: module 'yeelight.transitions' has no attribute 'randomloop'

i’m using HA in Container

how can i fix it ?

the configuration is:

yeelight:
  devices:
    192.168.1.X:
      name: Luce Salotto
    192.168.1.X:
      name: Luce Camera
    192.168.1.X:
      name: Lampada Desktop
2 Likes

Yeah, I dont think that something we can fix by configuration.
I had the same error and I tried removing the config and setting up everything as new, but it just broke in new way:

2020-10-09 00:18:01 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry Yeelight Strip 1 for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 316, in async_unload
    result = await component.async_unload_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 292, in async_unload_entry
    return await hass.data[DOMAIN].async_unload_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 172, in async_unload_entry
    raise ValueError("Config entry was never loaded!")
ValueError: Config entry was never loaded!

It’s a known issue. The fix is listed by jfhenriques.

1 Like

Thanks a lot, i’ll check there

Thanks for fix, here is easy way:

copy folder “yeelight” from here: https://github.com/home-assistant/core/tree/dev/homeassistant/components

to /config/custom_components/yeelight

in light.py replace “yee_transitions.randomloop” to “yee_transitions.random_loop” (it appears twice)

restart

5 Likes

Welcome to the community :grinning: Yeelight is working now after changes. Thanks

1 Like

Thank you, the workaround is working, anyway I rollback to 0.116 and I’ll wait for a next HA version. Going always with FIX/WA is not a good idea, since could be break with future releases.

1 Like

This is the best “work-around”. Works for me without messing with the code.

Nothing to lose with the custom component approach, just before you install an update that claims to fix the issue, delete the folder, nothing more needed. If it still doesn’t work correctly, put the folder back again.

In fact, an add-on that could do that with any integration would be a useful tool for development as well as quick fixes.

0.116.2 has solved the issue for me too.

Confirmed, however I’ll keep the WA files in a safe place, just in case… :slight_smile: