Xgimi Projector Custom Integration

Here is a self recommendation, I made a custom integration for XGIMI projector:

New XGIMI system seems to turn off the ADB access and I can not find an easy way to turn on ADB to use Android TV integration.

Details are in the readme of github repo. This integration is in very early stage, suggestions and contributions are welcome! Stars are welcome if you find it useful.

4 Likes

I was so glad to find this integration. It’s definitely frustrating to not be able to turn the projector on directly with HA, but i’ve kinda worked around it be sticking a Switchbot next to the power button, but would love to figure out how to manage the states in HA with that.

The power status(ON/OFF) is the state of the entity (e.g. remote.z6x) if you refering to that. Other status like the screen ON/OFF or media playing status is possible, but I am still working on that. BTW, an another alternative for powering ON is to turn on the auto-start-when-plug-in option in the system setting and use a smart plug to control.

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 :slight_smile:

any luck with the media player integration?

I did some experimentation with adding a bluetooth keyboard to the projector. I found I can use most of the remove functions using a keyboard. However I could not find a way to turn off the projector with the keyboard. If there is such a key that can emulate the power button then it might be possible to build a device using esp32 and GitHub - dmamontov/esphome-blekeyboard: ESPHome BLE Keyboard to emulate key presses and power on the projector.

UPDATE: it appears that the power button is not sending a typical keyboard press. The keyboard that I connected to the projector has a Bluetooth connection indicator light. The the projector is sleeping the indicator light is flashing meaning there’s no connection, so no button presses will be sent to the projector while it’s sleeping. The Xgimi remote must be sending some kind of broadcast. I don’t have the tools or knowledge to sniff the BLE messages to fingers out the messages, so hoping that somebody the does can figure this out and share with all of us.

@jimmy_z

Ok, after some searching and experimentation I managed to find a way to turn on Xgimi Halo+ using a BLE message sent from another device (in my case it was an Android phone using “nRF Connect for Mobile” app).

Here’s the Advertiser configuration I’ve used:

I’ve posted a more detailed answer on Stack Overflow.

Next I’ll see if I can send such a message from ESPHome…

Well done and thank you for your contribution!
Maybe you can figure out how to send from the Bluetooth module of RPI directly, instead of ESPHome dongle.

@alexbeatle I suspect the Bluetooth module in RPI will be already used by Home Assistant’s Bluetooth integration.
Perhaps Home Assistant allows use of the BT module from a custom integration, but it’s a much steeper learning curve for me, compared to using ESP32, for which I have already played with BT stack and created a virtual BT keyboard, with which I can control the projector (except the power button).

For my use case I already have an ESP32 device near the projector (I’ve built it into the projector screen actually) so it seems logical to use it for powering on the projector.

1 Like

Did you manage to send the message via esphome?

I tried using your method but it didn’t work for me. I also have xgimi elfin.

Quick question: so if my xgimi elfin is powered off via the remote which I always do, how would the communication with Bluetooth even work?

@bachoo786 No I have not had a chance to experiment with it.

so if my xgimi elfin is powered off via the remote which I always do, how would the communication with Bluetooth even work?

If the device is completely powered off then the BT remote won’t work. The device needs to be in Standby mode. In standby it does disconnected any BT devices connected to it (such as BT keyboard), but does listed to special BT advertisement messages, which the remote power button sends. See more details: ios - How can I clone a non-paired BLE signal from a remote to trigger a device? - Stack Overflow

1 Like

I have found a custom Bluetooth integration for HA: GitHub - hcoohb/hass-yeelightbt: Home assistant custom component for Yeelight bluetooth
It can potentially be used as an example to create another integration to broadcast the power on message. I don’t have time to work on this unfortunately. May be @jimmy_z will be able to look into it?

Oh ok thanks. I tried the custom component but it doesn’t work for xgimi elfin unfortunately.

Power-on has been supported in the latest release of the Xgimi-4-Home-Assistant
Please see this issue
Currently, the ble advertisement is done through HA host(in my case RPI4), but it seems possible with esphome

1 Like

I found the advertisement ID with this app on my MacBook: ‎Bluetooth Ranger on the Mac App Store

Just in case someone else needs it too.

Perhaps this can be upgraded to media_player - using the following homebridge as an example?
https://github.com/fantasytu/homebridge-xgimi-tv/tree/master

I used their format to send custom command which allowed me to launch apps.
Replace:

self._advance_command = str({"action": 20000, "controlCmd": {"data": "command_holder", "delayTime": 0, "mode": 5, "time": 0, "type": 0}, "msgid": "2"})

with

self._advance_command = str({"action": 20000, "controlCmd": {"data": "command_holder", "delayTime": 0, "mode": 7, "time": 0, "type": 1}, "msgid": "2"})

Example: launch Kodi app using package name

action: remote.send_command
data:
  command: org.xbmc.kodi
target:
  entity_id: remote.<remote_name>

All app package names can be found using “Package Names” app or via:

http://{{you_projector_ip}}:16741/data/data/com.xgimi.vcontrol/app_appDatas/list

Any way to use this to toggle Game Mode on and off? Would like to avoid scripting out all of the button presses to get there manually, if at all possible, to avoid all the obvious variables in doing that.