stoner221 / homebridge-xbox-onoff

Ability to turn Xbox one on and off
0 stars 0 forks source link

Xbox Off #1

Open stoner221 opened 8 years ago

stoner221 commented 8 years ago

Still working on command for xbox off.

TheTrollCaptain commented 6 years ago

Hey guys... I've spent the last 3 hours on WireShark, Python, and my Xbox trying to find a way to clone the "power off" packet. I don't know how far you are or how much you already know, but I'd like to report my findings just in case...

1) The "Wake-packet" behavior: Firstly, I captured the wake packet sent from my iPhone (Xbox Smartglass App to Xbox One) on Wireshark. I copied the data from that packet, put it into a python packet sender program I wrote, and fortunately enough, the xbox one turns on! This means replaying the wake packet from another computer works, thus this technique can be used in homebridge to power on the xbox.

Here is where everyone gets stumped with this task I'm guessing:

2) The "Poweroff-packet" behavior: Since the wake packet was easily copied and replayed to trick the Xbox, I tried that same procedure to trick the Xbox to turn off. Here is what gets interesting, I copied the data from the poweroff packet, pasted it into my program, and sent it. Instead of the Xbox accepting the command and powering off, it pings back with another, very large, packet. I think this packet is some kind of indicator/security check that prevents the xbox from powering off from any other program but Smartglass.

I have a theory as to why the Xbox isn't turning off: I think a "Smartglass-official" session between the client and Xbox is required to execute commands such as power off. I think this is true because as soon as the regular Smartglass app and the Xbox connect, they talk between each other a lot (according to wireshark captures), whereas a script only sends one packet. The xbox may use this as a security check. This would also make sense why the Wake packet can be replayed. Since it is impossible to connect to a powered off xbox through the Smartglass app, a session between the two devices is not required, hence we can replay it.

Anyways, this is kind of long and probably very confusing.. but hope it helps! You can ask me anything

TheTrollCaptain commented 6 years ago

Update: That "very large" packet that the Xbox One sends back looks like this in plaintext,

��XboxOne$6C29431C-0D8E-A244-CA16-B445A0C36EFCK0�G0�/������,M�h��H���0  �H��  0%1#0!U XBL Smart Glass Issuing CA0 180104043344Z 180203043344Z010U FD0015CC751816710Y0�H�=�H�=B��}= p�X�lА�=��O�P�5ީi�̚q��B2�&�J���<����2�WI�V� (��H0F0U�0U% 0 +0U#0�?����`�,3���I�h{@Z0  �H��  � ��A��&ER8�t-B��`��H��r0.�����a�x���k!7�������EE�ƨ1����JZ�Gz�:��U�ʼ �F�������&��c��RY8c�i���P~��O-�0? �7�>�>�A�+��Ys��@����w����;j$S�/q:�'�j�n�l*�2^�:!PS6���n��O����V��6�˼��v���>\��RfP���ʴ�CQ��E6�뎆���N���^w��٠]vC����t-6Q

The line that states, "XBL Smart Glass Issuing CA0" infers that poweroff may be showing an access denied sort of error...

mreassassin commented 6 years ago

How do you set this up? I’ve in stalled the homebridge xbox one plugin and added the accessory to the config.json input all my Xbox info and homebridge is recognizing it and sending the on signal. But the xbox does not turn on. Any ideas? Would love to get the off function working as well.

TylerD89 commented 6 years ago

@mreassassin This plugin is currently just a developement and still requires a ton of research to get working... In the meantime, I suggest this: https://www.npmjs.com/package/homebridge-xbox-one

That plugin, like the rest, currently only supports power on. But hopefully we will get this one working soon 👍🏻

TylerD89 commented 6 years ago

@mreassassin And to answer your question, double check your “Live ID” and IP address. Also note that static IPs work the best with any type of Wake on LAN... Otherwise, try turning on the xbox with homebridge, then post your homebridge log

tuxuser commented 6 years ago

https://github.com/joelday/DarkId.SmartGlass

TylerD89 commented 6 years ago

@tuxuser nice one. Hopefully stoner sees that

mreassassin commented 6 years ago

@tylerD89 how do I post a log. I’m using putty to install and test everything.

TylerD89 commented 6 years ago

Start up homebridge like regular and post all of the text that it spits out on the screen

mreassassin commented 6 years ago

@TylerD89 double checked all numbers were correct. tried upper and lower case letters. hard booted my xbox. it IS an xboxoneX. does that make a difference? copy/pasted log below.

[3/19/2018, 10:06:26 PM] [Wink] Initializing Wink platform... [3/19/2018, 10:06:26 PM] Loading 1 accessories... [3/19/2018, 10:06:26 PM] [Xbox] Initializing Xbox accessory... [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Kitchen Outlet (binary_switch/675469) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Mar Window Sensor (sensor_pod/456393) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Garage Entry Motion Sensor (sensor_pod/456401) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Upstairs Plug (binary_switch/675549) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Master Window Sensor (sensor_pod/456465) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Perez Home Downstairs Thermostat (thermostat/297687) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Perez Home Upstairs Thermostat (thermostat/298145) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Front Porch (binary_switch/715949) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Side Garage (binary_switch/716697) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Our Room (binary_switch/716746) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Living Room (binary_switch/721900) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Front House (binary_switch/722105) [3/19/2018, 10:06:26 PM] [Wink] Loaded from cache: Garage Entry (binary_switch/722106) Setup Payload: X-HM://0023ORAYQIE88 Scan this code with your HomeKit app on your iOS device to pair with Homebridge:

Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:

┌────────────┐
│ 131-45-154 │
└────────────┘

[3/19/2018, 10:06:26 PM] Homebridge is running on port 51826. [3/19/2018, 10:06:26 PM] [Wink] Refreshing devices... [3/19/2018, 10:06:29 PM] [Wink] Devices refreshed [3/19/2018, 10:06:29 PM] [Wink] Checking if hub is reachable (MarHub, 192.168.1.197)... [3/19/2018, 10:06:34 PM] [Wink] Hub is not reachable locally (MarHub, 192.168.1.197). Error: ESOCKETTIMEDOUT [3/19/2018, 10:06:34 PM] [Wink] Will continue without local control for hub (MarHub, 192.168.1.197) [3/19/2018, 10:07:03 PM] [Xbox] Sending on command to 'Xbox'... [3/19/2018, 10:07:05 PM] [Xbox] Sending on command to 'Xbox'...

TylerD89 commented 6 years ago

Hmm... so homebridge is loading it, it also sends packets, but not actually doing anything... Most likely, it could be this plugin specifically. Try uninstalling this plugin and try the one I mentioned above ^^. That one works for me at the moment. If that plugin doesnt work, Microsoft may have changed the wake protocol for the Xbox One X, which is, an entirely new issue and sucks

TylerD89 commented 6 years ago

@mrassassin ^^

stoner221 commented 6 years ago

Hey all well what i went about doing was capturing the infared codes for he on and off for the xbox. Then built a ir repeater to send codes from homebridge. I did see the post from @tuxuser and from @TheTrollCaptain ill look into this and see if i cant get this to work since it would be alot eaiser.

mreassassin commented 6 years ago

@TylerD89 I tried that plugin as well. no dice. any harm in having both plugins installed? How can I be sure I've uninstalled one version and only have the other? and that they're in the correct directory? @stoner221 have you tried on an xbox one x?

mreassassin commented 6 years ago

I was able to uninstall the original plugin and tried this (on/off) plugin. Here's what I get (I'm not sure why it's complainnig about 192.168.1.137 that ip is not listed in the config.json)

[6/25/2018, 11:00:24 PM] [Xbox] Xbox is offline [6/25/2018, 11:00:33 PM] [Xbox] Xbox is offline [6/25/2018, 11:00:35 PM] [Xbox] Sending on command to 'Xbox'... Error: getaddrinfo ENOTFOUND <192.168.1.137> at errnoException (dns.js:28:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:79:26)

also I think i have my plugins installed in different directories. i get different accessories depending on if I use 'homebridge' or 'sudo homebridge'. please help. :)

400HPMustang commented 5 years ago

@stoner221 I was wondering if you had made any progress integrating that smartglass library into your homebridge plugin?

stoner221 commented 5 years ago

Well I have made slight progress so what I have found you have to get the public certificate from the discovery response encrypt it then send that with your live I’d and the payload for power off to shut it down right now I am working on the crypto side of things it’s been a bit of a uphill battle.

400HPMustang commented 5 years ago

@stoner221 I came across this just this morning, https://openxbox.org/ I wonder if it might be more feasible to port their package instead since they have a .NET package and a .py version that already works with a different HA platform?

mreassassin commented 5 years ago

@stoner221 is there Xbox eject disc capabilities anywhere in there? My button broke... 😕

tuxuser commented 5 years ago

@mreassassin As I told you already, this functionality is not implemented with the SmartGlass protocol. It's nothing we could add either.

mreassassin commented 5 years ago

@tuxuser always get a second opinion 😉 turns out my Xbox was still under warranty! Got a free replacement!😁 Thanks for all the help.