Flux Led/MagicLight don't work since few updated

Hello, I have faced with same error.
I took latest code from githab and plased it /config/custom_components/flux_led/light.py

light.yaml

  - platform: flux_led
    devices:
      192.168.0.214:
        name: rgb_stripe
        mode: 'rgb'

I am able to change color and set effect. Once I try change brightness I see that it shows previous state on UI but, in fact it changes. Other worst thing that if stripe powered off then it will not turn on. After, led controller stucks, then it needs to be reboot.

Hi Ybarigou. I put this file in …/config/custom_components/flux_led/light.py amd I supposed to do more here than just that? json or init? I’m new to HA so not very clear atm.

Hi Repomanz,

Copy the whole thing from https://github.com/home-assistant/core/tree/dev/homeassistant/components/flux_led to your …/config/custom_components/flux_led/ and override the light.py with my script

Then you need to add the config to your .yaml:

light:
  - platform: flux_led
    automatic_add: true

(or add devices specifically with their IP addresses: https://www.home-assistant.io/integrations/flux_led/)

Hi ybarigou - thanks for the fix; seems I’m back up in running. Do you think the main dev will merge this code into main branch at some point? like the additional UI updates for the lovelace controls.

Hi,
Maybe someone has problem with turning on and delay of updating state. I am not able turn on device and don’t see any log. Is there any way to debug what the problem?
ybarigou could you give me some advice about it?

Hey, yes can confirm, at least I am still having issues with my Flux LED lights. If i turn them on or off using a switch on the Lovelace UI, it seems to break them, so that the next time they are called to be turned on, they don’t light up, whatsoever. However, in my automation, I notice that I can switch on a light so long as I add brightness or color temp data along with the request:

{
    "color_temp": 250,
    "brightness": 125
}

So now, If I need to manually control the lights, I do so by google home/assistant. And home assistant only interacts with the lights via automation where I can send the color temp and brightness.

I updated the code with a dirty fix should work now without the need to select RGBW for White only bulbs/led controllers; therefore, the mode can just be ‘w’ for monochromatic lights.

Also, RGBW bulbs are now directly considered RGB to fix the problem. In conclusion, with using the code I provided here, just keep every bulb’s mode in the configuration.yaml as is, i.e.:
…

  • for RGBW bulbs/controllers:

mode: rgbw

  • for RGB bulbs/controllers:

mode: rgb

  • for monochromatic bulbs/controllers:

mode: w

1 Like

hi , thank you for trying to solve this , i have applied your instruction but i get the following.

Logger: homeassistant
Source: custom_components/flux_led/light.py:285 
First occurred: 10:11:04 PM (4 occurrences) 
Last logged: 10:12:34 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 561, in _update_entity_states
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 277, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 316, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 434, in state_attributes
    data[ATTR_EFFECT] = self.effect
  File "/config/custom_components/flux_led/light.py", line 285, in effect
    current_mode = self._bulb.raw_state[3]
TypeError: 'NoneType' object is not subscriptable

any ideas ?

Thank you so much for this fix man, it fixed pretty much all my problems. One question though, is there a way to get the lights to turn to warm white instead of cool white when using the switch from the lovelace ui?

Warm white from Lovelace does not work with this fix unfortunately, it’s just a band-aid fix anyway…

This seems to be working for my v8 and v6 ledenet led controllers, but not for the v4. Any advice on how I can make sure to keep those working as well as I have a mix of those around the house.

You can ask the company for a firmware update so the v4 updates to v8, do this through Support in the MagicHome app. I just ran into this problem trying to troubleshoot one of my controllers randomly dropping from the network and asked if I could update the firmware. (mistake!!) They responded saying the “released” the firmware update to all my devices and when I managed each device I could see they had an update available. Had I known that would spark an entirely new issue with ALL my LED lights, I would never have done it, but regardless they are all v8 now. I am about to try this fix and hope I can get control back on them.

Any chance the code changes/band-aid fixes mentioned here are going to be part of an upcoming HA release?

Can I ask you Why you are using ledenet protocol?

That works! Thank you!

Also having the issue. Manipulate Magic Home RGB Controller (v8) from Home Assistant and the light turns off. Change color and turn on/off/on in the mobile app ‘wakes’ the light again.

I noticed that if I restart Home Assistant and only change brightness and color it works fine. However if I touch ‘color temp’ or ‘white value’ the lights stop working. Also turning off the light will break it.

Finally figured out how to get working on my rpi.

  1. Create the folder
    /config/custom_components/flux_led

  2. Create file __init__.py and paste
    """The flux_led component."""

  3. Create file manifest.json and paste

{
    "domain": "flux_led",
    "name": "Flux LED/MagicLight",
    "documentation": "https://www.home-assistant.io/integrations/flux_led",
    "requirements": ["flux_led==0.22"],
    "codeowners": []
  }
  1. Create file light.py and paste content from @ybarigou gist
    https://gist.github.com/ybarigou/52d42cd2e6b44bb70cbdb317a059e623

  2. Validate and reboot home assistant

2 Likes

This is awesome man! Happy I didn’t yeet my controllers although I have to admit I was tempted too :smiley:

Had some concerns since I’m running HA in Docker, but was able to add the updated files to the custom components and BOOM! It (FINALLY) works!!!

Appreciate the effort,

Cheers

Thanks for the step by step guide.
I followed it, but I don’t have any change.
I should have done thing right. I see in the log the message

You are using a custom integration for flux_led which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

But I see this other message:

Setup of light platform flux_led is taking over 10 seconds.

Any hint?
Is there a method to raise this 10 second timeout?
Thanks.

EDIT: I SOLVED
I write two lines to help who could be with problems after following the guide.
The guide is perfect, but it still didn’t work to me. There were two problems yet.
I had to disable the autodiscover of the devices. I had to write in the configuration the their IPs.
Second the name of the entities changed after this operation, so I had to update the configuration where they were used. Now it looks to work. Thanks a lot for your posts, they are really useful.

Thank you very much! I follow the guide and now my leds are working perfectly