AlexGustafsson / homebridge-wol

A Wake on Lan plugin for Homebridge
MIT License
301 stars 30 forks source link

wake and sleep xbox? #46

Closed mreassassin closed 4 years ago

mreassassin commented 6 years ago

can this be used to wake and turn off an xbox?

I'm trying but not succeeding.

{ "accessory": "NetworkDevice", "name": "My XBOX", "ip": "192.168.1.36", "wakeCommand": "ssh 192.168.1.36 caffeinate -u -t 300" },

thanks!

AlexGustafsson commented 6 years ago

As far as I can tell Xbox doesn’t rely on Wake On LAN, rather a proprietary protocol to turn the device on. This could be done as a program or script which is then used as a wake command. The simple answer is therefore “yes and no” - yes, wake command allows for this and no - the built in functionality of Wake On LAN does not work.

This gist implements the protocol in some simple C# code: https://gist.github.com/HakanL/48cdc64a032445a9881b70fa11f43972

I do not have an Xbox and therefore I cannot try it out.

This repository: https://github.com/Schamper/xbox-remote-power/blob/master/README.md seems to implement the protocol in python. The description even mentions how to use the script.

As for shutdown, you’re probably better off looking for a complete Smart Glass implementation which you can then call via wake and shutdown commands.

Please take a look around and come back with any potential findings you make!

Good luck!

mreassassin commented 6 years ago

i was able to get this working with cmdswitch2 calling the python script you referenced. thanks!

now I'm trying to get my ps4 to wake and sleep with this. here's my config:

"accessory": "NetworkDevice", "name": "Playstation", "mac": "<mac address>", "ip": "192.168.1.42:997", "pingInterval": 45, "wakeCommand": "sudo ssh 192.168.1.42 caffeinate -u -t 300", "wakeGraceTime": 90, "shutdownGraceTime": 15, "shutdownCommand": "sudo ssh 192.168.1.42 sudo shutdown -h now"

I'm trying with forcing the port 997, not sure if it's open on my router for the ps4, though. not sure how to do that.

thanks!

mreassassin commented 6 years ago

this is what I get in the output:

[2018-8-19 11:38:09] [Playstation] NetworkDevice awake cycle started for "Playstation" (192.168.1.42:997) [2018-8-19 11:38:09] [Playstation] Attempting to wake up "Playstation" (192.168.1.42:997) [2018-8-19 11:38:09] [Playstation] NetworkDevice "Playstation" (192.168.1.42:997) went from status "Offline" to "Waking Up" [2018-8-19 11:38:10] [Playstation] Attempting to wake up "Playstation" (192.168.1.42:997) using "sudo ssh 192.168.1.42 caffeinate -u -t 300" [2018-8-19 11:38:10] [Playstation] An error occured while trying to wake "Playstation" (192.168.1.42:997): Error: Command failed: sudo ssh 192.168.1.42 caffeinate -u -t 300 ssh: connect to host 192.168.1.42 port 22: Connection refused

mreassassin commented 6 years ago

it doesn't appear to be utilizing the port I want it to. it's defaulting to port 22.

AlexGustafsson commented 6 years ago

That command will likely not work for the PS4. The example is destined for Macs and MacBooks.

You could try this project; https://github.com/dhleong/ps4-waker/blob/master/README.md which you can install on your server and use as wake and shutdown command.

AlexGustafsson commented 4 years ago

Closing due to inactivity.