I created a new HA Custom Integration in order to control Ceiling Fans / Lamps using Bluetooth Low Energy Advertising, it is available here.
It allows to control directly from HA the Fans / Lamps that are controlled by one of the following Android Phone Apps:
FanLamp Pro
Zhi Jia
LampSmart Pro
Lamp Smart Pro - Soft Lighting / Smart Lighting
Zhi Guang
ApplianceSmart
Vmax smart
Zhi Mei Deng Kong
Smart Light
This HA custom integration is the equivalent of the ESPHome custom components already available and discussed in this topic, but directly in HA using the Bluetooth stack of the host and with discovery and configuration by UI directly.
I would need some BETA testers to help in bug discovery and feedback so if you are eligible based on requirements, and have a Fan / Lamp controlled by one of the given apps, please give it a try!
Hi @NicoIIT, I will beta test this later today and let you know.
I still have some problems with my ESP32 ârangeâ so this hopefully can be a great option!
Hi @NicoIIT, I just quickly tested it and itâs really good.
I just found what I think itâs a bug: I manually add the configuration because I knew the parameters (but I also try the âduplicate configâ) and when I add the name of the device and select the type of the main light it keeps asking me to configure at least one fan or light as per the picture below.
Of course the config is done from my side and I canât progress in any way. I tried to move some parameters to see if it allows me to proceed but it never did.
Just to confirm the lights blinked as asked in the setup so everything should work.
@Bonfo10 : fixed in Release 0.9.2! Copy / Paste issue: the finalization was blocked if no Fan was added whereas it should block only if no Fan nor Light is added.
I tried âduplicate configâ with the paired app. The integration detects the keypress and finds three configurations. But none of those lets the lamp blink, so the setup fails.
Are you sure the device is in pairing mode? For my fan I have to kill power and itâs only able to be paired in the first 5s. I would toggle power for each controller to restart pairing mode on your device
Yes! I now tried both: Pairing mode and discovery mode. Both with and without disconnecting the lamp from power before the pairing and / or each configuration attempt.
Iâll take one of my ESPs lying around to make sure itâs generally working and not a problem with the lamp. If that works, Iâll try again with the new integration.
Your phone app is not paired with your device (yes, this is a possibility, so I need to be sure ). Be sure the phone App effectively controls your device, and that you are not using the âMaster Controlâ part (does not exists in Fan Lamp Pro).
Your phone is near your HA host so the Bluetooth of the HA host can listen the Bluetooth of the phone, but the lamp is too far from the HA host and then the Bluetooth of the HA host cannot reach the lamp to control it
There is a bug! As the app is in beta, this is likely to occur⌠If you can I would need you to:
Launch âbtmonâ shell command (need sudo) on your host, this will start the monitoring of the bluetooth commands issued / received by your bluetooth card
Retry the same âDuplicate Configâ procedure
Stop the âbtmonâ command and copy the whole output into a new issue.
@Maxcodesthings: the âDuplicate Configâ does not require pairing, it is an interactive procedure that is listening to the commands issued by another already paired controller in order to reproduce them: Thatâs one of the main interest of this new component
I doubt it, but it may be possible. I just have one of those little usb-thumb-sticks for bluetooth, but the phone, the lamp and the stick are almost equally 2m away from each other in a triangle.
I will try this, when I am back at home in the evening.
Just played around with btmon⌠but apart from an extremely fast log stream (I must have a few too many bluetooth devices) thereâs not much to see here. In particular, the logged messages show no obvious relation to the lamp. On the other hand, an extremely large number of messages from smartphones, Shellys etc.
I suspect that itâs less to do with the integration and more to do with my setup.
As a test, I have set up an ESP32 with ESPHome and the components for it. The control works without any problems. Entering the parameters in the integration does not lead to any success. On the contrary, it hangs when testing the configuration.
For testing purposes, I am now setting up a fresh test environment on a Home Assistant Yellow.
In particular, the logged messages show no obvious relation to the lamp.
Yes this is normal, the base of the protocol of those lamps is to only emit commands using BLE Advertising (as UDP broadcast would do in network): there is no established connection with the lamps.
I must have a few too many bluetooth devices
I also think it could be the issue: the stack I am using (directly use the Bluetooth HCI socket) may be incompatible with an intensive use of the bluetooth card by other ways (bluez / dbus / âŚ). I am thinking of using the mgmt-api, this may solve some of the potential incompatibilities.
it hangs when testing the configuration
This one has to be fixed, if you could give me the parameters you used I will fix this!
Thanks for your tests, and sorry it does not work for you
Good news first: I set up a test environment with a Home Assistant Yellow (15.0) and the integration works like a charm even with the yellow being 15m and a concrete wall away.
Nice work! Anything works out of the box with cloning the paired app.
I am still not shure where it fails in my main setup (that replaced the yellow earlier this year). But that seems to be a very specific failure of MY setup only.
So, thanks for your help! I am still trying to figure this out, but I will not bother you, unless I find a hint towards a solution.
P.S.: The âhangingâ parameters where fanlamp_pro_v3 (0x26935E80 / 1), which worked great on the ESP.
Interestingly they did not work with the Setup on the Yellow, there the working params where fanlamp_pro_v2 (0x26935E80 / 1).
I retried those on the main HA, but that did not work, either.
Hello @narolinus, First of all I really appreciate your various tests and the time you spend on this testing!
For the fanlam_pro_v2 vs fanlamp_pro_v3, the only difference between the 2 is that a supplementary key is generated (using python âpycryptodomeâ package) and added to the command sent. Most of the devices supporting the v2 are also supporting the v3 as they are just ignoring this supplementary key.
The problem is then probably linked to the âpycryptodomeâ pacakge. May I ask you to check in the HA logs the exception you (probably) have? And also the version of HA core and the version of pycroptodome installed with command:
Quick check before leaving for work: The command shows pycryptodome is not installed on the HAOS host, i guess it is installed a container than⌠have to check later.
There are not many errors logged or warnings logged. In CORE:
Logger: habluetooth.scanner
Source: runner.py:154
Firstime seen: 2025-03-24 at 06:06:35 (10 Events)
Lasttime seen: 2025-03-24 at 21:22:23
hci0 (8C:88:2B:53:CD:22): Bluetooth scanner has gone quiet for 111.03942108154297s, restarting
hci0 (8C:88:2B:53:CD:22): Bluetooth scanner has gone quiet for 93.77119445800781s, restarting
hci0 (8C:88:2B:53:CD:22): Bluetooth scanner has gone quiet for 98.95101165771484s, restarting
hci0 (8C:88:2B:53:CD:22): Bluetooth scanner has gone quiet for 117.13240051269531s, restarting
hci0 (8C:88:2B:53:CD:22): Bluetooth scanner has gone quiet for 97.90149688720703s, restarting
In Host:
2025-03-24 21:14:15.906 ha kernel: Bluetooth: hci0: Opcode 0x2041 failed: -16
2025-03-24 21:14:15.915 ha kernel: Bluetooth: hci0: Opcode 0x2041 failed: -16
2025-03-24 21:22:23.036 ha kernel: Bluetooth: hci0: Opcode 0x2041 failed: -16
2025-03-24 21:22:23.071 ha kernel: Bluetooth: hci0: Opcode 0x2041 failed: -16
(Some more of the same, always around the time of my tests.)
I got a new Bluetooth Stick for my HA-Main-Host and of course that was the problem⌠Now anything is working absolutely smooth. Sorry for wasting your time.
I think the fact that I got many Bluetooth-Proxies (Shellies and ESPHome) in my setup covered the problem as most of the other devices use those proxies.