Can't change LED color on MagicHome LED controller

It is now added support for a new protocol: https://github.com/home-assistant/home-assistant/pull/5097/files
This also make it easier for others to add an own protocol.

1 Like

Thanks @Danielhiversen. How would I make use of this? I have the v1, and currently I have to edit the code to change the bytes that are sent. And I have to do that every time I update HA it seems. Will this change make it so that I don’t have to do that?

Also, as it stands now, I don’t think I could purchase a v3 and have both of them work at the same time. Would this allow me to do that?

The work is done by @bah2830

It will be in the next release, and here is the documentation https://github.com/home-assistant/home-assistant.github.io/pull/1669/files

The protocol is called LEDNET, you can see the changes made here:
https://github.com/Danielhiversen/flux_led/blob/master/flux_led/init.py#L675
It is possible to add more protocols.

It think it should be possible to add lights with different protocols:

light:
  - platform: flux_led
    devices:
      192.168.1.10:
        name: NAME
        protocol: 'ledenet'

ligh 2t:
  - platform: flux_led
    devices:
      192.168.1.10:
        name: NAME
        

If that is not working, I think we can make another solution.

DId anyone get this working? I am using a RoHS wifi module for some LED light strips. They are configured as RGB in the Magic Home app and works fine, but I can also only turn it on and off via Home Assistant. I have tried color_name and rgb_color with no luck. This thread seems to be going down the right path…

1 Like

It looks like it may be best to wait until the next update. But one thing you may want to try is to set the mode: “rgb” in your configuration. It’s in post 25 on this thread.

Hi Guys, Hi @Danielhiversen

sorry for late response.

Today i updated to 0.36.1 and tried the new stuff with the LEDENET-Protocol.

Unfortunately for my v3 it is/was not working.

I did some comparing of the code with the old file

I had to comment one line (Line 709) in the setRgb Section (sorry if Section is wrong, I’m not a developer so i don’t know the real Word for this Python-Stuff :smile: )

Here is what i change

def setRgb(self, r,g,b, persist=True, brightness=None, retry=2):
    if brightness != None:
        (r, g, b) = self._calculateBrightness((r, g, b), brightness)
    if persist:
        msg = bytearray([0x31])
    else:
        msg = bytearray([0x41])
    msg.append(int(r))
    msg.append(int(g))
    msg.append(int(b))

    if self.protocol == "LEDENET":
        msg.append(0x00)

msg.append(0x00) --> to comment out (# is not working here in the Forum for me)
msg.append(0x00)
msg.append(0x0f)
try:
    self._send_msg(msg)
except socket.error:
    if retry:
        self.connect()
        self.setRgb(r,g,b, persist, max(retry-1, 0))

It looks like, there is one msg.append(0x00) too much.

Anyone here can confirm?

Heres my complete File after changes:

http://pastebin.com/bq5A5pee

BR

Lukas

If I’m not mistaken, the update was designed for the V1 controllers only. I haven’t used my V3 in a while and I bought several V1’s that I’m currently using. The update that came with .36 does allow color changing on V1 LEDENET controllers. I suspect there will be a need to add an additional param to specify the version number of the controller since they use a slightly different syntax.

@Danielhiversen, looks like @outrun is using a V3. Earlier in this thread we ran the scan to retrieve the raw info from our controllers. Looks like the 11th value in the raw data states the version number of the controller. Not sure how easy this would be to implement to auto discover the device version.

V1
python init.py --scan --scanresults --info
ACCF23DEDA14 [192.168.0.18] False [Color: (255, 255, 255) raw state: 129,37,36,97,33,1,255,255,255,0,1,240,240,43,]

V3
python init.py --scan --scanresults --info
ACCF239EFD08 [192.168.0.73] ON [Color: (180, 20, 17) raw state: 129,4,35,97,33,16,180,20,17,0,3,0,0,22,]

Or maybe it could be manually configured with something like…

light:
  - platform: flux_led
    devices:
      192.168.1.10:
        name: NAME
        protocol: 'ledenet'
          version: 'v3'
1 Like

Hi,

I have the same problem. Can only use HA to turn on/off the led. However, it works flawlessly with the magic home app. My controller is as below. (sorry there’s some Chinese in the link :slight_smile:)
https://item.taobao.com/item.htm?spm=a1z09.2.0.0.tOt3L2&id=520136167094&_u=q1vetme92964

I cannot do any coding but can definitely help to test if needed.

Thanks!

So glad I’m not the only one with these problems. I felt like I was taking crazy pills!

I’ve been doing some troubleshooting myself, and have been trying to modify the init.py for flux_led in an attempt to get my lights working.

Looks like the protocol for the V3 hubs.

Let me know if I can be of help on testing or anything!

With modifications, the v3 is already working. You could create a custom component or modify the existing init.py

Above, in this thread should be the information you need.

There is work in progress to add support for more devices: https://github.com/Danielhiversen/flux_led/pull/23

So if you want make sure that your device will be supported, you should test the pull request and add support for the protocol needed by your lights if it is missing.

@Danielhiversen Thanks for the update. I try to follow upcoming changes but I missed this one. The activity on this is looking good. Thanks again.

Hi,

I am using a UFO type LED controller. Before the 0.38 updates, i was using the LEDENET protocol. The color wouldnt change but on/off works very well.
After the update,

  1. if i do not use LEDENET protocol, the color/ brightness can be changed.
  2. no matter which protocol i use, the on/ off is very irresponsive and often times after i first switch on the LED, the HA status wont be updated and i cannot turn it off anymore.

Any one is experiencing the same issue?

He @yungling,

For my ufo it is working flawless. Here is my Config for thr device:

 - platform: flux_led
  devices:
    192.168.0.73:
      name: 'TV Ambiente'
      mode: "rgb"

Hope it helps you out.

BR

Lukas

Hi @outrun,

After one night, the LED magically works very smoothly…
Have no idea what has been changed. But now it seems very normal and responsive.
I will keep monitoring and report if anything odd. Thanks for the help!

I found the change i made in these two scenarios.
When i turn off “discovery”, the LED works perfectly.
But after i turn it back on, the lag happens again. Not sure if they are 100% related but the result can be reproduced.

@yungling
I also have discovery disabled, but if i turn discovery on the LED also works without issues.

BR

Lukas

We have a known problem with discovery caused by the flux_led discovery support recently added. You can track the problem here and here. A fix is coming shortly.

Thanks for informing! I keep the auto discovery off for now. :slight_smile:

Is there any way to make these fade on and off instead of an instant on/off?