Xgimi-4-Home-Assistant
Xgimi-4-Home-Assistant copied to clipboard
Will bluetooth now work?
With the release of 2022.8.0 that includes bluetooth control is there a way we can get this to work with Xgimi?
The hardest part is not HA side, currently I have not figured out how to simulate/fake a bluetooth signal to turn on XGIMI
Updates: The newest XGIMI mobile app now has feature to turn on the projector through bluetooth. There is no pairing required in this procedure, it seems like a BLE advertisement. If so, it is possible to simulate the bluetooth signal to turn on the projector from HA. I tried to analysis btsnoop_hci.log by wireshark but no luck. If anyone is familar with bluetooth protocol and willing to help please DM me :-)
I'd love to see this if you can get it working, unfortunately I don't have any BT experience but commenting to stay subscribed to this issue.
I don't have a solution either but I started a thread as well in the XGIMI Elfin forum (would probably make sense to start in other forums as well with many members): https://www.facebook.com/groups/xgimielfin/posts/864061654795310/?comment_id=864101604791315&reply_comment_id=864118484789627¬if_id=1670170784048565¬if_t=group_comment_mention
and the same topic: https://stackoverflow.com/questions/69921353/how-can-i-clone-a-non-paired-ble-signal-from-a-remote-to-trigger-a-device?fbclid=IwAR2eSos_uhunoYTj9VDkZVy0NQ1peo6PaN6w1lU6q-a-NE0ZVxB8ZjQNXNw
I also have an XGIMI projector and I would like to be able to turn it on via the Home assistant. Can this video help in any way? https://www.youtube.com/watch?v=NIBmiPtCDdM&list=PLlGYeZI9ysXKGJuA7f9lZ53Fk9tYO-pDP&index=1&t=317s
I solved it for the XGIMI Elfin 🥳🥳🥳 It has worked for several weeks now. Have a look at my answer here for more instructions.
The only time I wasn't able to turn on the projector was after it had been off for a couple of days. On this occasion a non-paired remote control was still able to turn the projector on, so maybe there's one more advertising scenario I may have not yet understood. But I will have to wait for a couple of days again leaving the projector off before I can further explore this. It's also possible that on this special occasion maybe the BLE advertising app just didn't work properly. To be continued...
I solved it for the XGIMI Elfin 🥳🥳🥳 It has worked for several weeks now. Have a look at my answer here for more instructions.
The only time I wasn't able to turn on the projector was after it had been off for a couple of days. On this occasion a non-paired remote control was still able to turn the projector on, so maybe there's one more advertising scenario I may have not yet understood. But I will have to wait for a couple of days again leaving the projector off before I can further explore this. It's also possible that on this special occasion maybe the BLE advertising app just didn't work properly. To be continued...
Thanks for sharing, that's really a breakthrough. Could you elaborate more on how to get UUID and Manufacturer Specific Data by scanning the remote?
@manymuch You're welcome. For the Xgimi Halo+ there's now also the BLE information available thanks to the contribution of Muxa.
To sniff the information needed I used ubertooth BLE sniffer device with a command like this ubertooth-btle -f -t1C:F3:01:B9:81:99 (the MAC address of the remote control can be easily figured out beforehand). Because the ubertooth was too expensive I didn't keep it, instead I have now ordered a Nordic Semiconductor nRF52840 USB-Dongle which I hope will do work in a similar manner.
You might also be able to get all needed information using a BLE app on your phone. There are a couple available in the app stores and I was also able to see a signal from the XGIMI remote including manufacturer data if I recall right, but it wasn't a very straightforward way to run an analysis.
Another potentially sufficient approach without the need of an extra BLE sniffer device could be bluetoothctl which is part of BLUEZ for linux: https://stackoverflow.com/questions/36607626/how-to-use-bluetoothctl-like-hcitool-lescan-to-report-repeated-proximity-beacons
With hcitool you might be successful as well but hcitool commands only work up to BLE 4.0 devices. You can find such USB dongles for a few bucks online. I ordered one with CSR 8510 A10 chipset (Qualcomm) but haven't found time yet to experiment more with it.
@manymuch I added additional comments here also regarding BLE sniffer experience with Bluetooth Smart Scanner App . The initial post in this thread also refers to this sniffer app. With such app you might not even need a separate BLE sniffer device.
Updates: I powered on my Xgimi projector(z6x) succesfully through EFR connect. Here is the manufacture Specific Data I found by Bluetooth Smart Scanner App: Company Code: 0x0046 Data: 0x12D7C7899B9F80FFFFFF3043524B544D Besides, I have also noticed that the first 4 digits are random Working on next step: using sending BLE with Bluez from raspberrypi, or maybe even from esphome.
Thank you for the update @manymuch and congratulations!
I think I had also been successful with Bluez turning the projector on but right now I'm not able to replicate my previous success. At least I can provide you with some commands that I think work to run advertising signal (just adapt for your data):
bluetoothctl
[bluetooth]# menu advertise [bluetooth]# uuids 0x1812 [bluetooth]# manufacturer 0x46 0x7e 0x31 0xdb 0x31 0xb2 0x24 0x40 0xff 0xff 0xff 0x30 0x43 0x52 0x4b 0x54 0x4d [bluetooth]# back [bluetooth]# advertise on
When you purchase an old BLE 4.0 USB dongle with Cambridge Silicon Radio chipset (it should show Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode) when you run lsusb) you can use hcitool commands which maybe work better than bluetoothctl, but maybe your raspberry bluetooth chipset also supports hcitool. I haven't had time yet to further look into options to use my linux device to turn on the projector.
@helgek Success!!! Using exactly your command(except for manufacturer data), I am now able to power on the projector from my raspberrypi, it seems replicable for now, need more times to verify.
@manymuch So great to hear this!! I think with my Intel NUC integrated bluetooth adapter it's not this reliable or maybe it has something to do with the Bluez version or something else 🤷 I'm looking forward to more updates from you when you have completed more testing! It's so nice to see that this BLE topic gains pace now, will also interesting to see if this might also find its way into Home Assistant's recent Bluetooth implementation efforts
@manymuch btw, I never found this XGIMI app that you mentioned in your initial post. Maybe it could provide additional insights into BLE commands being exchanged/sent between remote and projector.
additional note: I also added your finding to the Stackoverflow thread
Update: I have implemented the poweron command into the xgimi integration. The ble advertisement is based on bluez-peripheral. The new integration has been released as v0.0.2
The poweron is not very stable but work in most of the time as I tested.
@helgek to answer your questions:
- Home Assistant Bluetooth implementation seems to only have passive ble reading functionality, and does not provide ble advertisement function AFAIK.
- The Xgimi app seems to only have Chinese version and not available on google play store. Here is the official link to download apk directly. And since the app is designed for Chinese market, I am not sure if provide multiple language and supports your xgimi model. BTW, the UDP command I used in this integration is obtained by sniffering the app.
Hi. I found the wakeup code for XGIMI Horizon pro 4K.
Company ID:0x0046 Data:0x1A7E0C743AEF18FFFFFF3043524B544D
On a diffarent way, is it possible to use the HDMI CEC signal as a more reliable power-on signal than BLE? https://www.home-assistant.io/integrations/hdmi_cec/ https://github.com/ideaChenGo/esp-cec
@uni-uni-77 Of course, but HDMI CEC is not suitable for everyone and also requires additional hardware. Besides, my XGIMI z6x does not support HDMI CEC :(
@manymuch thanks a lot for your integration update and the interesting insights you provided! In addition: I can't thank you enough for providing these UDP commands in your integration! I was about to try to run a a bluetooth keyboard emulation on my Intel NUC device which would have been a far less preferable option for several reasons. I will try your integration later and let you know how it works for me. Regarding reliability I had also mixed experience with Bluez but I can't tell if the issues are related to Bluez or the BLE adapter. Hopefully it will become clearer by the time, maybe also with more users sharing their experience. I've e.g. had the impression that Bluez would sometimes not stop advertising even though I had sent the stop command. Similar experience I also had at least once with the Bluetooth Smart Scanner App on my Android device. So possibly the issues are more software-related than hardware-related.
Maybe an idea which could help to increase reliability: Maybe one could check the power on status of the projector in your integration and repeat the BLE advertisement until a positive response.
Hi. I found the wakeup code for XGIMI Horizon pro 4K.
Company ID:0x0046 Data:0x1A7E0C743AEF18FFFFFF3043524B544D
On a diffarent way, is it possible to use the HDMI CEC signal as a more reliable power-on signal than BLE? https://www.home-assistant.io/integrations/hdmi_cec/ https://github.com/ideaChenGo/esp-cec
@uni-uni-77 thank you for sharing your findings! I updated the [Stackoverflow thread] (https://stackoverflow.com/questions/69921353/how-can-i-clone-a-non-paired-ble-signal-from-a-remote-to-trigger-a-device/75551013#75551013) to include the information for this projector as well.
Also the information regarding existing HDMI CEC implementation projects is really interesting. My projector is connected to a soundbar which doesn't send a power on command but I'm now wondering if maybe an HDMI splitter could be used to connect the projector to an additional device which would send the power on command. For the moment in my setup I think I will be satisfied enough with the BLE advertisement solution but maybe at some point I'd also be interested to have a closer look at this alternative approach.
@helgek Hi, could you kindly provide your hardware information? I’m currently running HaOS 9.5 on a virtual machine and attempting to use an Intel 3168 Bluetooth adapter, but have encountered some errors:
[bluetooth]# advertise on
LEAdvertisingManager not found
Failed to register advertising
Would you be able to share any relevant information about your system specifications? Thank you.
Is there anyone tried to use ESP32 as ble server to broadcase the power on signal?
@giuem bluetoothctl seems to be quite buggy and unstable from what I've experienced so far. I had similar errors and often it helped to simply restart the system. I think for the moment if one seeks for a stable advertisement solution an ESP32 based solution as just mentioned by sasukebinbin could be the more reliable approach. Alternatively you could look into using the older hcitool commands which work with older bluetooth dongles (as outlined in my previous post ). I added one such older BLE4.0 dongle to my Intel NUC setup but I haven't found time yet to run more tests. Find more info e.g. here and here.
My Intel NUC is this one. The bluetooth adapter is this according to lsusb: Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP)
@sasukebinbin Here is the a reference using esphome to send ble advertisement.
@sasukebinbin Here is the a reference using esphome to send ble advertisement.
Thanks for the reference. But it's a bit difficult to understand. Cause I think he is just giving an example on using 2 ESP32 to run as Client and Server. But actually we just need a Server to advertise. Not good at C++... Anyone can help to give an example on create a button and when press the button then set manufacturer data and advertising.
The hardcoded manufacturer code doesn't work at all on my xgimi H3 projector with mainland China firmware. So I guess I might need another one?
I just captured the BLE poweron event, I get this data:

and I have changed the yaml code accordingly, but no luck, still no poweron. remote:
- platform: xgimi name: H3 host: 192.168.0.143 token: "D1497DBDA42360FFFFFF3043524B544D"
@netweaver1970 for initial validation if power on works for your projector using the manufacturer data you captured I suggest using an android device with EFR Connect. The required settings in this app can be found here. Once this has hopefully worked out successfully there will be a better starting point to look into the BLE power on integration from manymuch and investigate potential reasons why you haven’t been successful with it .
That's true, if no luck with integration directly, try step by step verification
- EFR connect on an android device
- bluetoothctl from terminal of your HA host
- finally the xgimi integration