Can't change LED color on MagicHome LED controller

@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?

@simpat1zq I gave it a try… Unfortantly same behavior you are describing. My Slider moves to 100℅ if a use it freuqent.

BR

Lukas

@outrun
I believe you said you had a V1 and a V3. Do you see that same behavior for both of them, or just the V1.

@simpat1zq no i have only v3, i think @Kbeesnees has a v1 and a v3

I assumed my V1 is the same as others and unless I’m missing something, the changes that have worked for others haven’t work for me. I am using RGBW strips with these controllers as well, I did try the mode RGB on both and on my V3, the brightness control works but it does have the same bug that @simpat1zq mentioned with resetting the slider to 100% while leaving the LEDs at the correct setting. I noticed after the update and not using RGB mode, I’m not able to control the white with the slider. Sorry I’m not a coder so I know I’m not the most helpful. Does anyone know if might be possible to include the white in the color selector and have the brightness slider effect RGBW? I’ll be looking into trying to packet capture sometime early this week.

I had a chance to do a bit more testing and found my error. I misread the changes for the V1 and didn’t realize it needed a third 0x00. Sorry if I caused any confusion. I can confirm the V1 revisions work on the V1 and the V3 revisions work on the V3. I do get the same effect with the brightness slider bug on both.

It seems that we need to support different protocols for different versions of the bulb.
I hope we can find a way to detect the version of the bulb. Since the is able to detect the version, we should also be able to do so.

It would be great if some people with different versions of the bulb could dowloand the latest version of the lib https://github.com/Danielhiversen/flux_led/blob/master/flux_led/init.py and run
python __init__.py --scan --scanresults --info
Then post the output and the version of the bulb here.

The script will print the received bytes for each bulb.
Some of the bytes in the received message are already known: https://github.com/Danielhiversen/flux_led/blob/master/flux_led/init.py#L512

With the latest version of Hass (0.32.3) you specify the mode for each bulb.

  • mode: “rgbw” is the default and the same behavior as before. If you change the brightness slider, the bulb will go to the white-mode.
  • mode: “rgb” will keep the color but change brightness when the brightness slider is changed.

@Danielhiversen heres the output for my v3

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,]

@Danielhiversen

Results from V1
pi@raspberrypi:/home/hass/.homeassistant/deps/flux_led $ python latest__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,]

Results from V3 Getting an error. Tried with the V1 on the network and by itself. Same result.
pi@raspberrypi:/home/hass/.homeassistant/deps/flux_led $ python latest__init__.py --scan --scanresults --info
Traceback (most recent call last):
File “latest__init__.py”, line 1416, in
main()
File “latest__init__.py”, line 1392, in main
print("{} [{}] {}".format(info[‘id’], info[‘ipaddr’],bulb))
File “latest__init__.py”, line 516, in str
pattern = rx[3]
TypeError: ‘NoneType’ object has no attribute ‘getitem

I have the XSOURCE controller here: http://amzn.to/2eeWLDm

python init.py --scan --scanresults --info
ACCF23C98FC4 [192.168.1.133] False [Custom pattern (Speed 67%) raw state: 129,37,36,96,33,11,1,173,82,0,1,0,90,177,]

Wanted to update the V1 byte information for warm white. The RGB function works with the config you posted but the warm white/brightness slider doesn’t. I found for my controller the config should be the following, line 616 = (0x00), line 617 = (0x00), line 618 = (0x0f). If anyone else is using a V1 with a RGBW strip it would be great if this config could be tested on other devices.

My controller is a “XSOURCE” branded one from Amazon. The Magic Home app identifies it as a V1. I have a RGBW strip hooked up to it.

The only function that works from Home Assistant is on/off. Neither color change or brightness does anything. Strangely however, if I change the color with the Magic Home app, the new color shows on the bulb icon in Home Assistant.

I did some packet captures from the Magic Home app doing various functions.

master on - 71:23:0f:a3
blue - 31:00:00:ff:00:00:f0:0f:2f
green - 31:00:ff:00:00:00:f0:0f:2f
red - 31:ff:00:00:00:00:f0:0f:2f
blue - 31:00:00:ff:00:00:f0:0f:2f
blue brightness change - 31:00:00:82:00:00:f0:0f:b2
rgb brightness to 0 - 31:00:00:00:00:00:f0:0f:30
white on - 31:00:00:00:ff:00:0f:0f:4e
white off - 31:00:00:00:00:00:0f:0f:4f
white on - 31:00:00:00:ff:00:0f:0f:4e
white brightness change 25% - 31:00:00:00:3f:00:0f:0f:8e
master off - 71:24:0f:a4

Looking at the code again, I just realized the packet captures have a extra byte in them compared to the flux_led code! I added the extra byte to both the “SetWarmWhite255” and “SetRGB” functions and now they work from Home Assistant!

Only issue now is the brightness slider… it only changes the brightness of the white LEDs (which is fine), however setting it to 0 turns both the white and color LEDs off. So I can’t totally turn the white LEDs off.

I believe the reason for the extra byte is because this controller supports RGBWW. A RGB strip with both independently controllable cool white and warm white LEDs. You have to manually set your wiring configuration inside the app. Changing the wiring configuration shows/hides various functions inside the app. See the below screen shot.

The software does seem to know the controller requires the extra bytes. As it sends the extra bytes regardless of what wiring configuration you select.

1 Like

He Guys,

not really for this Topic, but is there a List which Service Commands(color, on/off and so on) are working with the Controller?