ESPHome On A Lepro (Lamplux) Smart RGB LED Ceiling Light

If you have one of these lights and want to remove reliance on the shitty Tuya cloud platform, this is a bit of a guide/walkthrough for re-flashing the firmware with ESPHome and gaining local control using Home Assistant. 

I bought one of these ceiling lights from the Bezos cock rocket fund a little while ago, not realising it was a Tuya device. I don’t like Tuya. I think they are a bunch of disingenuous tossers. I like things running locally (and not just a promise that it will ‘in the future’). A light should not have to connect to a server on the other side of the planet just so I can turn it on!

Turned out the firmware was too recent to allow for flashing via TuyaConvert and, for one device, I really couldn’t be arsed to jump through the hoops required for the LocalTuya integration. If anything was possible, I was going to have to access the internals. These lights are actually quite easy to dismantle. The diffuser will come off with the use of a guitar pick prising tool or the corner of a credit card.

Once the diffuser is off, there are a few cross head screws holding the main LED board to the casing, remove these and carefully separate the connectors so you can get the board out of the way.

Under the LED board is a separate circuit board containing a TYWE3L chip, which is just a rebranded form of the ESP8266. Good news for the potential flasher! Unfortunately, there aren’t any nice solder points or pin headers, so you either need to solder directly to the chip or use some form of 3D printed jig to hold pogo pins during the flash. Unusually (for me), I sidestepped the 3D printed approach and elected to solder.

So, armed with the pinouts, some trimmed jumper wires and hopefully a steady hand, the chip was set up for flashing. I used some short jumper wires with female DuPont connectors. Looking at the assembly of the lamp, there was enough room to leave these in place when re-assembling the lamp. Useful if things go tits up in the future, requiring another connected re-flash.

One important thing to note is the TYWE3L requires GPIO0 to be grounded in order to initiate flashing.

To make this easier, I made up a Y adaptor combining the two jumpers that connect to the TYWE3L into a single wire for the FDDI adaptor. You could obviously just twist wires but I like a bit of stability.

Some reference guides say to just ground it during the boot process but I left it connected to ground during the entire flashing process and it worked just fine.

TYWE3L Pinouts and connections for flashing.

Jumpers Soldered Directly To The TYWE3L

Y Adaptor To Ease The Flashing Process

I’m not going into the whys and wherefores but I prefer ESPHome over Tasmota. You can use the flashing process to put either firmware on the chip but the rest of this walkthrough is going to focus on ESPHome.

You will need a USB TTL Serial Adapter and ESPHome Flasher to get the thing connected up. Other flashing utilities are available but, once again, it’s my preference.

First of all, you want to set up a new ESPHome Node in Home Assistant. If you don’t know how to do that, pop over to the ESPHome site and familiarise yourself with the process. You can just set up a basic node with a name and your WiFI settings. Select ESP8266 on the board type screen (not that it matters - the settings will be replaced). Skip the bit that wants to connect to the device.

At this point, you can either flash the lamp with some basic settings which will allow you to do the rest of the config over the air or, you can edit the configuration replacing the defaults with the template provided at the bottom of this post.

Whichever method you choose, it’s time to get flashing.

If you are using the basic settings, you can just manually download the .bin file to flash using ESPHome Flasher or, if your system is capable of using the inbuilt flasher, you can use the 'connected to this PC' option in ESPHome - I've had inconsistent results with the inbuilt flashing tool so I generally download the .bin file.

TTL Adaptor Connected Up & Ready To Flash

If you want flash a working configuration straight away, you will need to edit the node you have just created.

At the time, there was no reference template for this ceiling light so I had to base my initial config on something that 'looked' similar. Unfortunately the colour and white GPIOs didn't match so a bunch of swapping and uploading edits ensued. I'll save you the pain by providing my configuration template as a starter.

Sample Configuration

Copy and paste the configuration below into the edit window of your node - change the device_name, friendly_name and wifi entries to match your requirements and network. I also always recommend setting a static IP. I've got a range excluded from DHCP in my router or you can let DHCP do it's thing and then set a reservation so the device always gets the same address - horses for courses.

substitutions:
  device_name: "ceiling_rgb"
  friendly_name: "RGB Ceiling Lamp"
# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  - platform: esphome

esphome:
  name: ${device_name}
  platform: ESP8266
  board: esp01_1m
  
wifi:
  ssid: #replacewithyourssid
  password: #replacewithyourwifipassword


# uncomment these lines and edit with your ip configuration
# leave comments if using DHCP (not recommended)
#  manual_ip:
#    static_ip: 192.168.0.10
#    gateway: 192.168.0.1
#    subnet: 255.255.255.0

# Enable fallback hotspot (captive portal) in case wifi connection fails

  ap:
    ssid: "${device_name} Hotspot"
    password: ""

captive_portal:

web_server:
 port: 80

sensor:
  - platform: uptime
    name: ${friendly_name} Uptime

  - platform: wifi_signal
    name: ${friendly_name} Signal Strength

output:
  - platform: esp8266_pwm
    id: output_r
    pin: GPIO4
  - platform: esp8266_pwm
    id: output_cw
    pin: GPIO5
  - platform: esp8266_pwm
    pin: GPIO12
    id: output_g
  - platform: esp8266_pwm
    pin: GPIO13
    id: output_ww
  - platform: esp8266_pwm
    pin: GPIO14
    id: output_b

light:
  - platform: rgbww
    color_interlock: true
    name: ${friendly_name}
    red: output_r
    green: output_g
    blue: output_b
    warm_white: output_ww
    cold_white: output_cw
    cold_white_color_temperature: 5700 K
    warm_white_color_temperature: 3000 K

I hope this helps you get this and other TYWE3L based devices under local control!

NOTE

Please don't ask for support regarding flashing this lamp - I've documented exactly what I did and provided sample code. If it doesn't work, you have either done something wrong or the board on the lamp has changed from when this post was written. If the ESPHome configuration ever changes, I will update the post. I can offer no more help than that.

Comments

You should also read:

Mini ESPHome Motion & Light Sensor - D1 Mini

I use a lot of ESPHome based motion and light sensors in my Home Assistant setup. If there is a readily available 5 volt supply, I will use them in place of Zigbee sensors. I just find them more dependable.