Convert a "smart" chinese lamp to a real smart lamp

Hello,

A friend buoght a cheap rebranded chinese lamp from, i believe, Leroy merlin.
A quick search brought up a aliexpress insertion with the same lamp.

This lamp has a bluetooth app (a really crappy one) and a remote, I dont know if its bluetooth or a generic RF.

My info scouting:

  • the led driver has a AC input of 165-265V and an output of DC 132-196V at 240 mA. Model XR 40-60WX2
  • The lamp has a warm and cold led stripe, analog from what i understand. You can set white temperature and brightness via app or remote.
  • I tried to understand what does the dimming and found a MT9712BD for the 2 channels, but the leg labeled PWM is not connected so, with my limited knowledge of eletronics, i dont know what regulates the dimming (specs sheet MT9712BD-LPF PWM Dimmable-Maxic Technology, Inc. )
  • There is a chip that I cannot find on the internet that could be the “brain” named FTD7111, is connected directly to an antenna, a crystal for clock i guess and some other caps and res.






The app is called LampSmartPro, you can find it on the play store with a wopping 2,2 score.

I would like to integrate this lamp in home assistant, I believe that it would be possibile in a couple ways:

  • Reverse engineer the bluetooth communication used and use a esp32 to command it, I tried with no success but im no expert
  • Bypass the FTD7111 and place a ESP to command it directly
  • Replace the led driver with something that works in HA, possibly with a esp on board.

Any idea? Im stuck atm, any input would be appreciated.

1 Like

Thank you for the input, I’ve been searching to reverse engineer the bluetooth comunication but I found out only tutorials and videos for a sniffer. This seems promising and I’m trying with my phones but note spit out the bluetooth log that i need.
I tried with a Huawei Mate 10 Pro, a Mate 20 Pro and a Nokia 3.1 with no success.
Now I’m waiting for an old samsung galaxy note II with a custom rom to charge

good luck!

I’ve been trying for 2 hours.
I tried with:

  • Huawei Mate 10 Pro - no bluetooth logs, no matter what i try
  • Mate 20 pro, same as 10
  • Nokia 3.1 same
  • Samsung Galaxy note II with custom rom - works, but data is a mess, there is no btatt protocol. Only HCI_CMD or HCI_EVT
  • a hacked nintendo switch with android - same as samsung

In the log i can not find the mac address, I have some temp sensors that use bluetooth in my house so its a bit noisy.

I attach the log if someone wants to check it out 9.3 KB file on MEGA

I sent some commands from the app during the dump

Hi!!!

I found this repo, and it seems to be interesting for those lights.

Someone can have a look if it’s possible to do something to integrate into hassio??

https://github.com/MasterDevX/lampify

I wish to find it sooner, I just replaced literally 2 days ago all the leds inside and the controller with some 24v CCT strips and a RGBW controller with esphome

Sorry I received mine today!!! I ´am struggling with the driver because it’s very high voltage DC120-200 at 210mA not very common.

I want to drive it with DALI drivers but no luck to find this voltage… it’s a shame because the leds are very bright

Did anyone manage to get some progress with this?

I have 3 of these Ali Express lamps. All of them work with the “Zhi Jia” app (via Bluetooth), and all of them have the same problem. When you turn it on via the wall switch it randomly changes brightness and color temperature… very annoying.

I tried to reverse engineer it with Wireshark. Similar to @exico91 I can’t get any btatt logs to show up. I do get the Bluetooth logs, but when I filter by “btatt” there is nothing. Sniffed from a Motorola phone.

I wanted to try the Lampify project, but got stuck as well. I’m running Hassio, so I don’t have make/apt-get/gcc… installed. Maybe it would be easier to rewrite the whole thing as a custom integration. The code itself doesn’t seem too complicated.

The most obvious and simple solution would be to change the driver. However, as @ouranos6 pointed out, that is almost impossible, due to their weird non standard voltages. I’ve bough 5-6 chandeliers from Ali Express. They are all the same way. The leds are connected serially, resulting in totally weird output voltages, and huge wattages. So finding a replacement with the same specifications and some “better” smart support (e.g. at least Tuya), is almost impossible. e.g. I haven’t found a single Tuya driver that is anything other than 12-24V DC. If someone has managed to find them, please let me know. I’d much rather just swap them out, than having to write this custom integration.

Another alternatives that comes to mind (and I also don’t know how to do) is if the driver can be modified somehow, so it functions just as a current transformer, not as a led controller. Then I could put an additional dimmer before the transformer (e.g. Shelly Dimmer 2) and control it that way.

Btw. I’m really surprised there are isn’t more info and solutions for this. Pretty much every chinese lamp uses these crappy drivers. I guess not a lot of people are buying lamps on ali express

Hi, I’m in this exact scenario. I had a previous identical light fixture that worked great with this (GitHub - aronsky/esphome-components: Custom components for ESPHome) but this new one, although it’s identical to the old one, uses the Zhi Jia apk and it’s incompatible with the code from Aronsky. Must be some bytes different when doing the initial setup/pairing.
If anyone has any idea how we can go about debugging this (be it BT sniffing from the app or the phisical remote, or decompiling the apk and grabbing the base bytes sent when doing the setup)…

I am new to HA and I wan hoping to integrate all my Chinese LED lamps into HA. Based on all the reading I have done, this seems like an impossible task. Is there any update/progress on this topic that could be shared?

Hey zolakt,
have you found a solution how to make those led driver less smart?
I have the same problem and trying to find a solution. I’m thinking of installing some remote switch and convert led driver to just turn on and off. with no changing color, etc.

You can try this GitHub - reverieline/bler: ESP32 BLE remote for ZhiJia (ZhiGuang) LED controller
It is for lights which work with Zhi Jia app,
My LED works with Zhi Guang app so it doesnt work for me.
I am looking for working solution, th elast resort is to disassemble original remote control and connect ESP32 relays to the buttons

This got my hopes up, but either I’m doing something wrong, or it doesn’t work. I have a Wemos D1 mini (clone) ESP8266 board. I downloaded the bin file from github and flashed it using https://esp.huhn.me/

However, I can’t see the BLER_AP access point. When you say that it doesn’t work for you, did you have the same problem, or have you managed to connect to the access point but none of the commands work? Any ideas what else to try?

Also, I doesn’t really do what I want. I don’t need on/off commands, I have relays for that. What I do need are commands to adjust brightness and color temperature, which it doesn’t seem to have. But anyway, it is a starting point. Maybe I could figure out how to add these commands myself

I flashed it with Platformio. Are you sure, that your bin file include all libraries?
I have no problem to see BLER-AP, but pair command didnt work,
I suppose, there are different bytes pair commands for each app/lights.

My light even don´t remember the last state after main power switch off. After power is restored, it turns on in random state (brightnes and color temp mode)
Looks like LED controller is from 20th century

in the russian forum

I found different attitude the solve this.
Replace led control chip in controller with ESP32 (PWM control), requires osciloscope

I wait for this board https://www.aliexpress.com/item/32879970752.html
to hook up with original remote control buttons and ESP32 GPIO
I spend too much time with BLE solution
if the light wasn’t nice designed, expensive and super bright, I throw it in the trash a long time ago

Not sure what the bin file contains. I just downloaded it from here Release 0.05 · reverieline/bler · GitHub

Yeah, the led controller is crap. It does remember the last state, but after you turn the light off, you must not turn it on again for some time (20s or 1min, i don’t remember). At least mine behaves that way.

What do you mean “replace led control chip in controller”? Are you replacing the chip in the controller or just hooking an esp to the remote (that is what that russian forum is talking about)? I considered hooking it up to a remote, but fried 2 esps along the way, so got irritated and put it on pause for a while. Supposably you don’t need optocouplers to make it work. That is the response I got on reddit Reddit - Dive into anything. But as I’ve said, I fried two boards, so I’m no expert :slight_smile:

They also talk about the replacing control chip (in comments), it seems too difficult to me because you have to find out control frequency.

I will rather use optocoupler to simulate button press (close contacts), not directly ESP pins to avoid destruction ESP chip
Before I found these optocouplers, I made my Somfy awning to be smart with zigbee relays hooked to Somfy remote (inching button contacts),
2years ago, it seems to me the easiest, cheapest and most convinent solution

One question about flashing the esp. Did you build it from source or you just deployed the same .bin from Platformio?

As for optocouplers and stuff… I’m actually tempted to try to replace the controller. That would be the best option probably, since it could read the state. Hooking up a remote will only send commands, no way to get any feedback. But yeah, probably too difficult for my non existing electronic skills. I’ll order a spare driver and experiment on that.

If you get any of these methods working, could you please post dummy-proof instructions here

Open .ini file in platformio, install all libraries, then compile .bin file and flash to ESP.

I do not need report the state (you can just add some current sensor), I want to control it only when I am in the same room by smart wall switch (decoupled) and control other features by voice or some nice zigbee button (not ugly original remote)
The optocouplers will arrive in 2 weeks (from China), then I post my solution.

Just to update. The GitHub - reverieline/bler: ESP32 BLE remote for ZhiJia (ZhiGuang) LED controller solution works for my lights. I had some problems with the WiFi manger, so I changed the code a little and hardcoded my SSID and password. After that all of the commands work fine.

The problem is that it can’t do much: turn on/off (which I don’t need), change color warm/cold/neutral and switch to night mode (I think it’s 50% brightness, maybe less).

What I’m missing is the brightness and color temperature control. The author on GitHub isn’t responding, but if I could sniff our the codes somehow, I could easily add this myself. Does anyone have a suggestion how to sniff them out?