Can't change LED color on MagicHome LED controller

I have the Wifi LED controller FROM HERE.. It works perfectly from the MagicHome app. And I can add it into HA using the Flux Light platform, and HA is able to turn the light on and off, but I can’t get it to change the color or brightness. Is there another configuration parameter that I need to get this working?

Have you clicked on the light name to open the “more info” box?

I have basically the same unit (different “brand” name, but otherwise identical) Can turn off/on, but attempting to change the brightness or color from HA does nothing. Works fine from the Magic Home app.

I grabbed some packet captures from the MagicHome app on my phone and compared them to what I could see in the source code for the Flux LED library… The bytes sent by the MagicHome app appear to match those that the library would send. Yet from Home Assistant only on/off works.

Yes. I clicked on the light and the brightness and color control dialog pops up. I change the slider and the color but the led doesn’t change.

Hmm, if the bytes sent by the MagicHome app matches the bytes sent from HA, I do not know how we can solve this issue.
Any errors in your log when you try to change the color? Which version of ha are you using?

I have newly fixed some bugs in the library, so you can try to use the latest version of library.

How do update the library? I updated HA to the latest version yesterday but that didn’t make a difference.

In your configuration folder you should replace the file deps/flux_led∕__init__.py with https://github.com/Danielhiversen/flux_led/blob/master/flux_led/init.py

But it will probably not solve your problem if do not see any errors in the log.

In the flux_led directory, I have an init.py file there. And when I download that one, and name it init.py, it disappears after starting HA. I might be missing a step here.

Incidentally I have the same problem. I have an LD382A (from amazon). Previously I was using FHEM for home control and automation and there the “WifiLight” module could control my LED strip with no problems.

I’ve compared the code: https://github.com/Danielhiversen/flux_led/blob/4c086bb7ebf26b6576b4ca6ea17241bf069cbb9b/flux_led/init.py#L641 matches https://github.com/herrmannj/wifilight/blob/4fd957b31258eeb9aa78bd63d0acb73501404ab8/FHEM/32_WifiLight.pm#L1305 except that in flux_led the last two bytes are 0x0f 0x0f but in WifiLight they are 0x00 0x0f.

Similar: https://github.com/Danielhiversen/flux_led/blob/4c086bb7ebf26b6576b4ca6ea17241bf069cbb9b/flux_led/init.py#L664 vs. https://github.com/herrmannj/wifilight/blob/4fd957b31258eeb9aa78bd63d0acb73501404ab8/FHEM/32_WifiLight.pm#L1380
flux_led: 0xf0 0x0f vs. WifiLight 0x00 0x0f.

I don’t have much time right now, but as a test I changed both instances in flux_led to 0x00 0x0f and now I can control colors. So, yeah, there may need to be changes to the protocol implementation.

@Danielhiversen With which device did you develop? Does the 0x00 0x0f also work with that? Or do we need to add some sort of subtype/device specific code?

I tried changing those bytes in the /home/username/.homeassistant/deps/flux_led init.py file, but whenever I restart HA, the file reverts back to the original. What do I need to do to get those changes to stick?

Hi Guys,

same problem here. On/Off and discover works perfectly, changeing the Color not.

Anything i can help to sort it out.

My controller: Controller

@simpat1zq
Did you already could solve your Problem?

It is working fine here with my devices, so not much I can do for debugging.

Have you tried the patch suggested by henryk ?

Yes. I did try the patch he suggested but it made no difference. I suspect that there might be slight variations with these magic home based units where they might require different codes sent to them depending on who made it.

I guess you are right, so you probably need to capture packets send from your phone app to a bulb, and compare it with data send from the flux_led library.

He Guys,

a get one Step ahead.

as discussed in this Thread:

I made some changes in the Flux-LED Component:

First of all I updated my HA to 0.32.2

After the Update i change the Line 641 and 664 to 0x00 in /home/hass/.homeassistant/deps/flux_led/init.py

After a restart of HA Color Changer is working, also Lamp-Symbol change the Color to the choosen color.

Brithness-Slider is not working at the moment. Any Ideas on this?

In my HomeMagic-App the Modell-Typ of my controler says ACCF239EFD08, v3 → Maybe it’s help someone for figuring out the Problem.

Thanks for help

BR

Lukas

@outrun You can try the new brightness control, that I am working on: https://github.com/home-assistant/home-assistant/issues/4303#issuecomment-259239596

I am not sure how we should add support for different byte signals.
But first I will try to see we your change also works for my bulbs. If we are lucky, the value does not matter for me bulbs.

@Danielhiversen I will give it try - maybe on Weekend. I’ll come back with the results.

Thanks

BR

@Danielhiversen

I just updated my file, and setting the mode to RGB appears to have worked. I can’t fully confirm because I’m actually doing this remotely right now. But when I make a change in HA, the app(using an Android emulator on my home PC) updates to whatever change I made in HA.

That said, for my particular model, I also had to make a change to line 616 to say “msg.append(0xf0)” instead of ‘0x0f’. After making that change and the other changes to lines 641 and 664 mentioned previously. I learned that via packet caps.

And as for the bytes, I’m not really sure what the best way to do that would be. It appears that there are at least 3 variations of ‘bytes’ that work for slightly different models.

For reference, in the MagicHome app, mine says version 1. @outrun mentioned that his said version 2. If anyone else reads this post, could you post what version yours says there? I’m wondering if the app uses that version number to determine what type of packet to send.

@simpat1zq mine says Version 3, just to avoid some mistakes.