Skip to content

Commit

Permalink
1. add more commands
Browse files Browse the repository at this point in the history
2. remove 544 port check at setup
  • Loading branch information
manymuch committed Jan 31, 2024
1 parent 47990cc commit de53775
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Xgimi-4-Home-Assistant
<img src="https://brands.home-assistant.io/xgimi/logo.png" width="360" height="120">
XGIMI integration for home assistant.

XGIMI integration for home assistant.
Please give me a star :star_struck: if you like it.


Expand Down Expand Up @@ -41,7 +41,8 @@ b. Linux terminal, use ``bluetoothctl`` in the terminal:
Adjust the the token after the manufacturer according to your projector's model. The first ``0x46`` is the company code followed by the actual manufacturer token.


Either with android app or with linux bluetoothctl, you should now able to poweron the projector without the remote.
Either with android app or with linux bluetoothctl, you should now able to poweron the projector without the remote.
[Here](https://github.com/manymuch/Xgimi-4-Home-Assistant/issues/5#issuecomment-1752887102) provides an alternative way to get the token without iOS or Android device.


### Choose a method to setup:
Expand Down Expand Up @@ -75,11 +76,20 @@ data:
target:
entity_id: remote.z6x
```
Current support command:
Available commands:
The below commands work for most devices:
```
play, pause, power, back, home, menu, right, left
play, pause, power, back, home, menu, right, left,
up, down, volumedown, volumeup,
poweron, poweroff, volumemute, autofocus
poweron, poweroff, volumemute
```
The below commands may only work for some devices, you can have a try and good luck :-)
```
autofocus, autofocus_new,
manual_focus_left, manual_focus_right,
motor_left_overstep, motor_left_start,
motor_right_overstep, motor_right_start, motor_stop,
shortcut_setting, choose_source, hibernate, xmusic
```
### Dashboard example
Expand Down
11 changes: 1 addition & 10 deletions custom_components/xgimi/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from .const import (
DOMAIN,
)
from .pyxgimi import XgimiApi


class XgimiConfigFLow(config_entries.ConfigFlow, domain=DOMAIN):
Expand All @@ -31,15 +30,7 @@ async def async_step_user(
else:
await self.async_set_unique_id(f"{name}-{token}")
self._abort_if_unique_id_configured()

xgimi_api = XgimiApi(
ip=host, command_port=16735, advance_port=16750, alive_port=554, manufacturer_data=token)
alive = await xgimi_api.async_check_alive()

if not alive:
errors[CONF_HOST] = "cannot_connect"
else:
return self.async_create_entry(title=user_input[CONF_NAME], data=user_input)
return self.async_create_entry(title=user_input[CONF_NAME], data=user_input)
else:
user_input = {}

Expand Down
2 changes: 1 addition & 1 deletion custom_components/xgimi/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "xgimi",
"name": "Xgimi Projector Remote",
"version": "v0.0.6",
"version": "v0.0.7",
"config_flow": true,
"integration_type": "device",
"documentation": "https://github.com/manymuch/Xgimi-4-Home-Assistant",
Expand Down
14 changes: 13 additions & 1 deletion custom_components/xgimi/pyxgimi.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,19 @@ def __init__(self, ip, command_port, advance_port, alive_port, manufacturer_data
"volumeup": "KEYPRESSES:115",
"poweroff": "KEYPRESSES:30",
"volumemute": "KEYPRESSES:113",
"autofocus": "KEYPRESSES:2099"
"autofocus": "KEYPRESSES:2099",
"autofocus_new": "KEYPRESSES:2103",
"manual_focus_left": "KEYPRESSES:2097",
"manual_focus_right": "KEYPRESSES:2098",
"motor_left_overstep": "KEYPRESSES:2095",
"motor_left_start": "KEYPRESSES:2092",
"motor_right_overstep": "KEYPRESSES:2096",
"motor_right_start": "KEYPRESSES:2093",
"motor_stop": "KEYPRESSES:2101",
"shortcut_setting": "KEYPRESSES:2094",
"choose_source": "KEYPRESSES:2102",
"hibernate": "KEYPRESSES:2106",
"xmusic": "KEYPRESSES:2108",
}
self._advance_command = str({"action": 20000, "controlCmd": {"data": "command_holder",
"delayTime": 0, "mode": 5, "time": 0, "type": 0}, "msgid": "2"})
Expand Down

0 comments on commit de53775

Please sign in to comment.