MagicLight/Flux WiFi Color LED Light Component

You use input boolean:

For anyone interested, I ended up using an ‘input_select’ so I can pull “random” as a selection in the drop down:

alias: "random_flux_rgb"
trigger:
  - platform: time
    seconds: '/45'
condition:
  - condition: state
    entity_id: input_select.rgb_light
    state: 'Random'
action:
  service: light.turn_on
  data:
    entity_id: light.livingroom_lamp
    effect: random

Still doing some tests, but so far this seems to work pretty well.

With the current version (0.34.4, and perhaps in previous versions but not in 0.28) I have found the lights become unreachable after some period of time.

I am starting to suspect that it may be connected to the loss of one of the configured lights on the network becoming unreachable after ha has started. I can’t yet pin it down, but I believe that if someone cut power to one of the flux lightbulbs by turning off the light switch, sometime after the flux_led component no longer can connect to any flux wifi light.

Below is the error in the log if I cut power to a bulb. But after 15 minutes, the others are still responsive, so my theory, admittedly, doesn’t yet have much validity - I’m sharing early at this point. I’ll check back in a while and report any changes. Not sure what to look for. Nonetheless, should the loss of one bulb really be generating this amount of errors in the log file? My logging is set to error only. A light being unreachable probably should simply be reported as “device unreachable.”

16-12-08 10:30:01 homeassistant.core: Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/home/pi/.homeassistant/deps/flux_led/__init__.py", line 812, in __readResponse
    chunk = self.__readRaw(remaining)
  File "/home/pi/.homeassistant/deps/flux_led/__init__.py", line 822, in __readRaw
    return self.socket.recv(byte_count)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.homeassistant/deps/flux_led/__init__.py", line 486, in refreshState
    rx = self.__readResponse(14)
  File "/home/pi/.homeassistant/deps/flux_led/__init__.py", line 814, in __readResponse
    self.reconnect()
  File "/home/pi/.homeassistant/deps/flux_led/__init__.py", line 791, in reconnect
    self.socket.connect((self.ipaddr, self.port))
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity_component.py", line 386, in _update_entity_states
    yield from update_coro
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity.py", line 213, in async_update_ha_state
    yield from self.hass.loop.run_in_executor(None, self.update)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/light/flux_led.py", line 159, in update
    self._bulb.refreshState()
  File "/home/pi/.homeassistant/deps/flux_led/__init__.py", line 489, in refreshState
    self.reconnect()
  File "/home/pi/.homeassistant/deps/flux_led/__init__.py", line 791, in reconnect
    self.socket.connect((self.ipaddr, self.port))
OSError: [Errno 113] No route to host

I have found it better and easier to go into router and adding the items to the address reservation setup under lan setup. https://gyazo.com/32656e57d11c0495000a1a5c68c6b071
And then adding the Ip addresses to the config file```

  • platform: flux_led
    devices:
    192.168.1.22:
    name: Cabinet Lights
    192.168.1.56:
    name: TV Color Lights
    192.168.1.61:
    name: TV Color Lights1
    keeps mine from disappearing. even if switch is tripped and comes back because I have the mac set to the IP my config file is looking for.

Thank you so much for putting this component together - I took a gamble and bought one of these off ebay

http://www.ebay.com.au/itm/DC12-24V-Wireless-WIFI-RGB-LED-Strip-Light-Controller-Remote-For-iOS-Android-/291878792712?hash=item43f554ee08:g:LcgAAOSwNRdX3lje

$12 AUD for a Wifi LED Strip controller - Yes please!

Guess what… IT WORKS… (mostly…) I got it working at first… after playing around alot the colours starting having a tantrum (I was getting over excited most likely) but the thing I found was the brightness control in HASS didn’t work (It does work in the Magic Home App.

I might do a separate post on this - $12 for a working strip light controller that integrates into HASS (even if it doesn’t dim) is an amazing find!

There are some variants out there of these controllers that still speak the same “MagicLight/MagicHome/Flux” protocol but have a ESP8266 chip inside instead of the HF-LBJ100. http://www.banggood.com/ARILUX-AL-LC09-Super-Mini-LED-WIFI-APP-Controller-RF-Remote-Control-For-RGB-LED-Strip-DC9-28V-p-1081344.html for example…

The controller you linked looks similar to one of them.

If you open it up, and it has a ESP8266… On most the RX/TX serial programming pins are exposed on the PCB. You can use a FTDI adapter and re-program the ESP8266 with one of many Arduino sketches that turns it into a MQTT controlled light, making it much easier to get full functionality with Home Assistant. (see: Alternative firmware for Arilux AL-LC03 for use with MQTT and Home Assistant (RGB light strip controller))

It seems to be different versions of the protocol. You can have look here: Can't change LED color on MagicHome LED controller

@Danielhiversen @Charles_Brown @mplawner I am trying to configure MagicLight LED wifi controller. Is there a workaround for connecting that wifi controller to my wifi network without creating MagicLight account?

Any comment/feedback highly appreciated.

Not that I am aware of you need to sign in to control the light from your mobile device. I have this in my light.yaml config

- platform: flux_led
  devices:
    192.168.1.23:
      name: TV Color Lights
    192.168.1.24:
      name: TV Color Lights1
    192.168.1.42:
      name: kitchen cabinet lights
    192.168.1.69:
      name: display light

maybe that will help point you in a direction that works.

How did you assign those IP address to LED controller. My LED controller only gave me option to connect adhoc network. (LED controller had local wifi controller to which I can connect my phone). I was only able to connect led controller to my home wifi after creating an account.

I also needed an account for the first setup. However, I created a temporary one with a trashmail.

If you don’t mind poking around the insides, you can load it with the tasmota firmware. Then it just uses mqtt commands for control

More info here >> https://github.com/arendst/Sonoff-Tasmota/wiki/MagicHome-LED-strip-controller

1 Like

I just did this :slight_smile: Thanks for the tip.

recently purchased a couple of led bubls that are controlled with the Magic Home android app.
They create a wifi ap named “LedenetXXXX” on startup.

The component can usually turn them on/off, but never change the color.
Am i stuck with a new version of the ledenet protocol ?

I would have no hesitation to flash alternative fw on them, unfortunately the rx, tx & gnd pads are unreachable.

Any hints ?

I have a bunch of the Magic Home LED strip controllers.

In the Magic Home app, you can associate the device to your Wifi network. Once its on your home network, you can control it with HA by pointing the FLUX_LED component to the IP address of the device. You’ll also need to include the “RGB” or RGBW" option in the yaml file (if you are missing this, this may be while you are missing the color option.

Also, make sure that your home router is assigning your device the same IP address every time, otherwise you’ll lose connectivity from HA.

If this doesn’t fix it, you can try flashing it with tasmota, but if its a bulb and not a controller, it might be a lot of work tearing it down.

Thanks for the hints, but i guess I must not have explained myself properly. I will try again ;

The bulbs are of the kind that create a wifi AP named “LedenetXXXX” on startup.
After having configured them with the Magic Home app, and after configuring the Flux_Led component in HA, i have these issues :

  • sometimes the bulb doesn’t switch on or off.
  • the colorpicker does not allow me to change the color.

I would love to flash Espurna in the bulbs, unfortunately the rx, tx, and gnd pads are unreachable even after opening the bulb. The esp is glued solid into the housing, no way to reach it except with unreasonable force.

I’ve read in this forum that the Ledenet - type bulbs are using a newer protocol, which the HA component doesn’t properly understand. Could this be what is going on here ?

1 Like

Yes, I understood you the first time (I think). The AP (access point) that these bulbs create are only suppose to be used temporarily, so that you can connect to the bulb using you app. Once connected to the bulb’s temporary access point, tap on the “+” mark on the top right in the Magic Home app. This will give you a menu. Select connect to wifi network and select the SSID of your home network, and it’s password.

Once the bulb is connected to your wifi network, it will get an IP address on your home network and then it can communicate with HA and you can control it.

I see my issue isn’t coming over properly :

There is no issue whatsoever to configure the bulbs into my network.
The bulbs work great in the Magic Home app.

There are some issues with controlling the lamp when using the flux_led component.
Sometimes it works, sometimes no.

I only mentioned the LedenetXXXX ssid to prove that these bulbs should be fully compatible.
But it seems they are not.

1 Like

Hi guys!

I have a bit of a hassle right here…
My homeassistant instance is running in my private cloud.
I have a couple of Flux_Led’s at home. But when i try to map the devices to my Homeassistant, i can only map just 1… since it uses port 5577.
I forward port 5577 to a specific IP of the flux_led.

I thought i could add a port number behind the ip addres in the config but that just doesnt work at all…

Ant idea’s? I tried to add a piece of code in the “/homeassistant/components/flux_led/lights.py” (which didnt work). but to be honnest… PHP, C#, ASP, etc. is my thing… but Python is a language i still cant speak haha…

Hope to hear from ya soon!

Flash it with Tasmota or ESPhome