Alternative firmware for Arilux AL-LC03 for use with MQTT and Home Assistant (RGB light strip controller)

Hey Robbie

Yep in particular needs to be an Arduino sketch for an ESP8266. If your is, can I get a copy of the code. I need to see why some will work and some won’t. I have tried everything here, on both MAC and WIN and neither will update any OTA ESP8266 based device who says their device is OTA compatible. In fact I can even update the standard example code for OTA that comes with the IDE. It’s frustrating because I’d like to incorporate it in some of the stuff I do.

TIA

I just added it to my fan controller project the other day. Here’s the commit.

Yep so the basic setup for OTA. Well it has to be my environment because I cannot get it to work here. As I said, I’v tried firmware from a few different people who say it supports OTA and it just don’t work. Now if that is the case for me it must also happen to others. That’s why I find OTA flaky at best.

BTW is that a NodeMCU based board because it does work on them. I believe they use ESP-12’s

Yup it’s a NodeMCU 1.0.

I wonder if there’s some limitation with the chip itself…

My first thought would be firewall maybe.
Do you have another device you can try to OTA from? That would give you a more definitive answer to if its you machine.

Make sure your arduino is upto date ect.

If no OTA scripts work at all it might be worth asking on the esp8266 arduino forums.

I’ve done a lot of reading. Let me ask you a question, what are your settings in the IDE when you upload to the unit specifically “Flash Size”.

Which model Arilux do you have exactly and do you know what type of ESP module is being used in it.

  • @aneisch: The support for RGBW is planned for April.
  • @KmanOz: I’ve included the code for OTA updates, but I didn’t have mentioned it as a feature. I’m also unable to update the firmware Over-The-Air (Mac, is working for my NodeMCUs 1.0).

Well it seems I have it going on my Sonoff Code but only on the Mac. Same ver of IDE & Python on both yet only 1 works. It’s very unpredictable to be honest.

EDIT: For anyone having issues with OTA, my Windows machine thought it was connected to a Public Network for some reason and the firewall was blocking the port. Once I changed it to Private Network, OTA just worked fine.

1 Like

I’ve just flashed this to a LC03. Great work on this project, many thanks! WOrks great with emultated_hue with Amazon Echo too,

One quick question on security, if I am not using the TLS option with the MQTT, what are the risks to me/my network?

Thanks.

Hi all,

I’ve been playing with this again today, and had an idea to buy several units and then group all of them in HA for control. The problem is, however, if I establish all of my units into a HA group, I am just given a single on/off switch, I loose the small bulb icon that exposes the colour and brightness sub-menu.

Does anyone know, please, if here is any way to set up multiple units up so that I can control brightness and colour on them simultaneously?

Thanks in advance.

EDIT: I had imagined I would set up each light with its own mqtt state and command topics thereby giving them all their own identity. I since been wondering - if I use the Arduino sketch as-is, and don’t edit it for each light, will they then be all pub/sub to the same topic, but I’m guessing this will lead to conflicts in mqtt when 6 lights are all simultaneously publishing states.

Hi,
If you’re using a local MQTT broker, TLS is for me, not mandatory. On the other hand, if you’re using a public MQTT broker, it’s recommended to use SSL/TLS because your credentials are sent in plain text (message MQTT CONNECT).

I think that it’s better to configure each light individually and to create another light (optimistic: false) to control all the lights at the same time. In the sketch, you need to add the code to subscribe to the group topics (see below) and the necessary code to handle these topics (callback method).

Light 1 - X (MQTT topics):
State:

  • State: arilux/1/state/state
  • Command: arilux/1/state/set
    Brightness:
  • State: arilux/1/brightness/state
  • Command: arilux/1/brightness/set
    Color:
  • State: arilux/1/color/state
  • Command: arilux/1/color/set

Group of lights 1 - X (optimistic mode: true):
State:

  • Command: arilux/group/state/set
    Brightness:
  • Command: arilux/group/brightness/set
    Color:
  • Command: arilux/group/color/set

Hi, I spent a few hours to make OTA work for this little gadget… and succeeed. Now, I am able to upload my code anytime. My controller arrived a few days ago, ordered from Banggood recently. I have noticed that they have changed the ESP8266 module version. The original post mentions ESP-12F but mine has ESP-12S. It’s a newer model with different flash layout/size - at least that was my idea. I need to say I’m NOT using Arduino IDE but PlatformIO to develop and upload stuff for my ESP modules, but I don’t think it is really matters. So, I used ‘CheckFlashConfig.ino’ (from Arduino/ESP8266 examples) to see what real size of flash do I have and it said it’s 1M not 512K and it reported ‘Flash chip configuration wrong’ error. AFAIK it means my new codes didn’t fit into the OTA when I tried it. Anyway, I quickly uploaded "BasicOTA.ino’ to confirm manual OTA uploads with espota.py and it worked. So I flashed this firmware for Arilux by mertenats (thanks!!!) and tried OTA on that again. All good.

[env:esp12e]
platform = espressif8266
board = esp12e
framework = arduino
upload_resetmethod = ck
board_flash_mode = dio
;board_f_flash = 40000000L
;board_f_cpu = 80000000L
build_flags = -Wl,-Tesp8266.flash.1m64.ld

note: esp8266.flash.1m64.ld means 1M (64K SPIFFS) flash size

Hope this helps someone with their OTA issues.

Oh, one more comment. The IR controller didn’t work either. Looks like the vendor includes a different IR remote these days. The codes are different. eg.

#define ARILUX_IR_CODE_KEY_OFF         0x7CCD4D09 // 0xFFF807
#define ARILUX_IR_CODE_KEY_ON          0x947173A1 // 0xFFB04F

I did a quick and dirty code change a around line 386 to see what IR codes the remote sends.

  DEBUG_PRINTLN(F("ERROR: IR code not defined"));
  DEBUG_PRINTLN(results.value);

@mertenats thank you for your reply. That is 90% clear, but just to check…

  1. Each time I flash a controller (1-x) I will edit and increment both the state and command topics in the sketch so that each controller is effectively unique in MQTT terms.
  2. Each light will be individually configured in HA yaml using its matching pub and sub topics, At this stage I will have 6 configured, working and individually addressable lights.

Correct so far?

Your next bit is my missing 10%! I tried, before posting yesterday, the MQTT concept of “+” to address the lights together, but the configuration was rejected by HA. Are you saying that /group/ is the same thing but the correct syntax in yaml? Is the example you’ve written to be used as-is, or does it require a HA group to be set-up and then that id used instead of /group/?

As an aside, I’ve also had it suggested in another thread that if I change the mqtt_client_id in the sketch (currently set to arilux) to be unique in each controller (the suggestion is to use the 8266 chip code for simplicity) then I can actually use multiple controllers with the same mqtt pub and sub details.

I’ve gone from being frustrated and stuck to having two routes, which is a good result in 24hrs! I’ll explore both…

Hi SethKins,
My solution is just a suggestion and I’ve not tried it yet.

  1. Correct
  2. Correct

Normally, with the MQTT protocol, we can use +and #. As you mentioned, it’s not working. My suggestion is to use a unique command_topic for all the lights, whatever it’s name.

Yes! Each device must have an unique ID.

char              MQTT_CLIENT_ID[7]                                 = {0};
...
  // get the Chip ID of the ESP and use it as the MQTT client ID
  sprintf(MQTT_CLIENT_ID, "%06X", ESP.getChipId());
  ...
  if (mqttClient.connect(MQTT_CLIENT_ID, settings.mqttUser, settings.mqttPassword)) {
  ...

Example here

Hi everyone,

I am interested in trying to flash one of these.

If I buy this:

and this:

Apart from a soldering iron will I need anything else? I dont really have any experience with hardware modifications. Do I need a usb to serial converter?

@kiwinol

That is the Arilux version of the controller which incorporates IR control as well as wifi. If you don’t plan on using the IR, get the AL-LC01.

Secondly, you won’t need pinheaders to reflash these boards, there are no pin holes to install them. You will have to solder temporary programming wires to pads on the board or use a custom made programming jig with pogo pins or the like.

You only need a usb/serial converter, a soldering iron and four dupont wires to reflash these. I have reflashed four of these, it only took about 15 minutes per board.

Thanks Dwalt. I have gone ahead and ordered everything including:
http://www.ebay.com.au/itm/272279719836
http://www.ebay.com.au/itm/172317051200

Now I just need to wait a month or so for everything to arrive. Then I may have some more questions :slight_smile:

1 Like

To answer to an open issue on the firmware’s Github page

Hi there,

I noticed there are also RGBW controllers:
http://www.banggood.com/ARILUX-AL-LC02-Super-Mini-LED-WIFI-APP-Controller-Dimmer-for-RGBW-LED-Strip-Light-DC-9-12V-p-1060222.html

would support be possible? :slight_smile:

I’ve ordered a RGBW lightstrip and I’ll try to convert my RGB controller into a RGBW controller (one free pin unused). However, I don’t know how to proceed with the firmware to handle the white channel.

  • Use the white channel if the RGB value is equal to 255, 255, 255 and turn off the others
  • Use the white channel as an independent light (ON/OFF, brightness)
  • Try to convert RGB into RGBW and vice versa (Home Assistant supports only RGB with the MQTT component)

Any advice? Thanks!