Can't change LED color on MagicHome LED controller

@simpat1zq:
Could you make a pull request with your changes to the flux led library https://github.com/Danielhiversen/flux_led ?
I do not promise to merge it, but that will make it easier to track the different variations.

@Danielhiversen

I was able to test it further, and it looks like it’s working good enough, but whenever I slide the brightness slider, the lights change as the should. However, the slider itself, most of the time, but not always, goes back to 100%, but the light stays at the correct brightness that I set it at. Any ideas as to why that is happening?

I’ll try and figure out how to do a pull request later today. I may need your help with that, as I don’t really know what that is. But I will let you know if I can’t figure it out.

Ok, I will have a look at it.

The easiest way to make a pull request is to go here; https://github.com/Danielhiversen/flux_led/edit/master/flux_led/init.py
Make your changes and choose < Create a new branch for this commit and start a pull request.>

I’ve been having the same issues as mentioned here. I have two types of these controllers. I can confirm that the changes suggested work for me on a V3 controller but do not work on a V1 controller. I’m very excited by this progress. One thing I notice on my V3 is when using the slider, it turns off any RGB settings and adjusts the W. If I manually select a color, the white turns off. Is this expected behavior or should the slider adjust the white indipentant of the color and leave the color setting the same?

@Kbeesnees Is the V1 controller working with the current implementation?

Yes, it is expected behavior with the current version of hass.
From the next release, it will be possible to set “mode: rgb” : Add support for rgb light in flux led lights, fixes issue #4303 by Danielhiversen · Pull Request #4332 · home-assistant/core · GitHub

Thanks Daniel. The V1 controller only turns on and off. Setting color in the frontend or running init.py manually in the console doesn’t work. I only have an RGB strip on the V1 controller at the moment and haven’t tested current on the W channel so I’m not sure what impact the slider has for white. I’ll have to test that later today as I’m headed to work.

@Danielhiversen

I made the pull request, and made the change to the 3 lines and submitted it. In doing that, I actually realized that at line 664, I had an extra 0x00. So I removed it. But that broke my installation. When I put it back in, it works, but I still have that issue with the slider.

@Danielhiversen

And I just figured out one more thing about the slider issue. It seems that it only happens the first time after it has been about 3 seconds since it happened.

For example, if I start up HA, and move the slider, it will move to 100, even though it correctly set the brightness. Then, I can keep moving the slider around, without issue, for 3 more seconds. After those 3 seconds are up, the next time I move the slider, it will go to 100.

And in addition to that, if I were to wait around 12 seconds, it doesn’t happen. So it appears to happen between about 3 and 12 seconds after the last time it happened.

I hope my description of the issue makes sense.

@simpat1zq:
Could you test if the new brightness function solves your problem: https://github.com/home-assistant/home-assistant/compare/dev...flux_led_brightness?expand=1#diff-e210dea810eca09f715430251856b713R116
(This is untested code, so there might be some bugs there)

Everyone:
Could you confirm that:
For V1 this is working: https://github.com/Danielhiversen/flux_led/pull/8/files
For V3 this is working: https://github.com/Danielhiversen/flux_led/compare/master...Patch_v3?expand=1

@Danielhiversen

The changes you made definitely did something. I’m seeing almost the same issue, except instead of it going to 100%, it going to almost zero. Some it seems to go right on zero, but sometimes it’s probably around 3% or somewhere in between. And in addition, around 15 seconds later, it seems to drop down there on it’s own.

@Danielhiversen

I made the suggested changes to test for the V1 controller. They didn’t seem to make an impact. Lights still only turn on and off. Color selection didn’t work for me. Any advice on how to capture the packets sent from the magic home app? I’d be willing to try to find the correct commands the controller needs. The V1 controller I have is LEDENET Smart WiFi LED Controller 5 Channels Control 4A5CH CW/WW RGB RGBW RGBWW LED light, Timer Music Group Sync Controller

@Danielhiversen can confirm changes for V3 are working, except the brightness slider. I was not able to test your new slider (I’m not home at the moment).

BR

Lukas

@Kbeesnees

To take a packet capture, I just installed Handy Andy Android emulator on my Windows computer, and set it to bridged mode for the networking. Then I ran wireshark on the windows machine.

And just to confirm, does your device show as V1 in the MagicHome app?

It might be worth trying the V3 patch as well. Also, make sure you are restarting HA after making any changes, and confirm that your changes are staying after restarting. There was a bug at some point in the flux_led component that cause all those files to be redownloaded and overwritten every time HA was restarted.

@outrun
Did you set the mode to rgb in the yaml config?

@Kbeesnees
I just saw your post in the other thread. Although my V1 is an XCSource ‘brand’, it looks exactly like the one you linked, so I’m thinking we have the exact same one. That V1 file that Daniel posted is the exact way that I did it. In addition, I set the mode to RGB. And it works for me, other than a minor aesthetic bug with the slider.

@simpat1zq

I agree. I assume they’re the same as well. I didn’t have much time to test last night and I’m currently at work (shhhh) so I’ll likely be testing it tomorrow or late tonight. I’ll be using a RGBW strip with it which works in the app but I’ll give RGB mode a try to see what it does. Nevertheless, I’m encouraged by the progress and attention this is getting. I also won’t have access to a windows machine this weekend but I’ll try to find a Debian alternative to packet capturing if I’m still having trouble after trying your suggestion.

[[edit]] I did try both mods on both controllers. One shows V1 and the other is V3 in the app. Only the V3 mods worked with the V3 controller. Haven’t tried the RGB mode yet. Also noticed the RGB mode got pushed to production today so I’ll update HA first before testing.

@Danielhiversen
Not sure how easily it could be implemented but similar to setting mode RGB, I was thinking a version option could be manually set to differentiate the different byte signals each need. I’m not sure if that would break it for other bulbs and controllers that it currently supports but it was just a thought.

@Danielhiversen - I can confirm v1 changes are effective here.

(edited to add) > I am using the same XCSOURCE controller simpat1zq mentioned in the first post. Magic Home app reports my lights are v1. I have six controllers, (all the same sku), they all work with this patch.

I do seem to have an issue where they get “stuck” and stop responding to packets occasionally. A power cycle fixes it. This causes exceptions in the HASS log. I didn’t notice this behavior before trying this fix, but I can’t say for sure that they are related. These controllers can be unreliable.

@Zen
That’s encouraging Zen. Thank you for the second confirmation. Curious which controller you have. Not sure if there is a difference between the LEDENET and XCSource. I’ll be testing my LEDENET in about 3 hours.

My apologies, I should have mentioned in my original post, I will edit.

I am using the XCSOURCE controller @simpat1zq linked in post 1.

Hi,

back with my result.

@Danielhiversen @simpat1zq I check out RGB-Mode. Now everything is working.

Here a Screenshot from my Implementation. Everything you can see, works as expected:

Thanks Guys for help. If there is anything i can test further. Let me know.

BR

Lukas

@outrun
When you change the slider, like once every second for 15 seconds, does the slider automatically move to 0 or 100 for you?