Flux Led/MagicLight don't work since few updated

This is caused by an issue with the Home Assistant flux_led component. I was able to patch it to resolve this by doing the following:

Edit light.py in your homeassistant/components/flux_led folder and change the following:

Comment out or delete these lines in the def turn_on(self, **kwargs) method:

#        if not self.is_on:
#            self._bulb.turnOn()

Further down in this method, below these lines:

        # Preserve current brightness on color/white level change
        if brightness is None:
            brightness = self.brightness

Add in the following:

        # If these are 0 then bulb.isOn will return false, not what we want
        if hs_color is None or (hs_color[0] == 0 and hs_color[1] == 0):
            hs_color = (1, 1, 1)
        
        if brightness is None or brightness == 0:
            brightness = 100

I’ve uploaded the modified light.py with the above changes made here:

So you can either make the edits above or just download the updated light.py file from the gist above and drop it in your homeassistant/components/flux_led folder and restart HA to solve the issue. The location of your homeassistant/components/flux_led folder will vary based on your Python setup, for me it was at /srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/flux_led

The issue seems to be caused because setting the brightness or colors to zero immediately after calling self._bulb.turnOn() (which the Home Assistant component is doing) causes the state in the library to be changed to off which causes the turn on and immediately turn off behaviour.

Also, this is the configuration I have for the LED Strip in my configuration.yaml

light:
  - platform: flux_led
    devices:
      192.168.1.100:
        name: LED Strip
        protocol: 'ledenet'
        mode: rgb

This was tested under Home Assistant 0.103.0.