arcreative / homebridge-xbox-one

Homebridge plugin to turn on Xbox One

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reset Xbox One power state back to off after turning it on

edgariscoding opened this issue · comments

Siri is able to successfully turn on my Xbox One, at which point HomeKit shows the Xbox One as "On".

I'm aware that Siri is not able to turn off the Xbox One, which is understandable.

The problem is that next time that I want to turn on the Xbox using Siri, she's not able to do it if the Xbox is still set to "On" within HomeKit.

Is there a way to configure the plugin so that when the Xbox is turned on, HomeKit is reset back to "Off" so that it can be successfully be turned on next time?

I can look into that... I think when I originally tried to do this integration I tried to use a momentary switch so there was no saved state, but was unable to do so for some reason or other. I'll take a look again and see if maybe i can add proper state checking and even turn off support, if there's any update on that. Smart glass (or "Xbox", now) has turn off support now, so maybe we'll have more luck his time around.

That would be amazing!

Same here. Can not power off xbox via siri. It will be great if you figure it out how to do it!

@tomaj As far as I can tell, only Microsoft can turn it off remotely, as they have a proprietary API to do it.

@edgar-sanchez-is are you still having this issue? I can turn my xbox on repeatedly without issue. Does this need another look or can I close it?

@arcreative - I think he's asking about returning the state on the Home app to off after turning the Xbox on? Rather than having troubles turning on his Xbox?

@ashman247 I’m a little hazy on the history at the moment, but I think this should be fixed as a result of using a ping to determine the on/off state of the device. If it’s still a problem, let me know and I can take a look at it in the near future.

Having the same issue. I turn on the Xbox via Siri, then I turn the console off, but Home says it is still on. I toggle it off in the app and it turns the Xbox back on again

Okay, will try to check it out. Haven't turned my Xbox on in about a year, but I'll see what I can do :-)

I'm having an issue where my homekit app shows the xbox as 'on' but it's not turing on the xbox.

can you help? I'd like to get the 'off' functionality to reflect on the homekit app as well if all goes well with the above issue.

thanks in advance!

Hi all, this was the reason I was originally ambivalent to merge #4, since I don't believe it will issue the "turn on" command if the device is (or is perceived to be) on already. Since we don't have the ability to turn it back off, I had originally set it up so you could just issue turn on commands all day, regardless of state. Thoughts?

I'm still not having any luck to get my xbox to turn on... the command is being received by homebridge and ip and live ID are correct. I'm trying to get it to work on my xbox one x. also tried on my other 2 xbox ones with no luck tho... any advice?

yes.

I'm wondering if I have pplugins in different directories. if i run 'homebridge' vs. 'sudo homebridge' i get different accessories recognized. Also, running 'homebridge' homekit doesn't connect. Maybe my network is jacked?

I'm now trying multiple xbox's. not sure if that's allowed, but really just need it on the first xbox one x.

{
	"bridge": {
		"name": "Homebridge1",
		"username": "CC:22:3D:E3:CE:30",
		"port": 51826,
		"pin": "131-45-154"
	},
	"description": "This is Marios Homebridge.",
	"platforms": [{
		"platform": "Wink",
		"name": "Wink",
		"client_id": "<redacted>",
		"client_secret": "<redacted>",
		"access_token": "<redacted>",
		"refresh_token": "<redacted>"
	}],
	"accessories": [{
		"accessory": "Xbox",
		"name": "Xbox One X",
		"ipAddress": "<192.168.1.36>",
		"liveId": "<MYLIVEIDHERE>",
		"tries": 10,
		"tryInterval": 1000,
		"waitForLastTry": false
	}, {
		"accessory": "Xbox",
		"name": "TF Xbox One",
		"ipAddress": "<192.168.1.35>",
		"liveId": "<MYLIVEIDHERE>",
		"tries": 10,
		"tryInterval": 1000,
		"waitForLastTry": false
	}, {
		"accessory": "Xbox",
		"name": "Xbox One",
		"ipAddress": "<192.168.1.41>",
		"liveId": "<MYLIVEIDHERE>",
		"tries": 10,
		"tryInterval": 1000,
		"waitForLastTry": false
	}]
}

any help appreciated!

thanks!

Hi @mreassassin, I would definitely recommend using static IPs for starters to make sure your Xbox IPs aren't bouncing around. Something over 192.168.1.2xx should be good, since that's usually outside of the DHCP pool. It should also be fine to target multiple Xboxes, though admittedly I've never tried it with an Xbox One S. I think it's also imperative that all the devices are set in the hot sleep mode (can't remember what this is called), because if it's fully off, it won't respond to the broadcast packet. Can you verify and let us know?

yes, all of these are true, other than assigned an IP in the 200 range. I did make them all static though. xbox is in 'rest mode' or whatever. the main one I'm looking to get working over homekit is the xbox one X (not S). so not sure if that's an issue.

running 'sudo homebridge' does NOT get me any changes that I make to my config.json file. only running 'homebridge' does. which doesn't connect to homekit (maybe it's not the same accessory?). it's somehow referencing some older version of my config.json file. did I maybe update my node version at some point and that is now cached? should I uninstall homebridge and re-install? how can I be sure all plugins are installed in the proper directory. I see some ended here:

/usr/local/lib/node_modules

and some in:

/home/pi/node_modules

only one config.json file exists though.

I would think that the ones in /home/pi are a result of running npm install <whatever> without using the -g command... Not sure if you have a package.json in that directory, but I would personally rimraf node_modules in your home folder to remove any doubt. If you know you're not going to be running node from other users, chowning the /usr/local/lib directory has been useful for me in the past as well. Not sure about your specific situation though, I still haven't been able to reproduce the "not working" issue!

It's also worth mentioning that your config could reside in either /home/pi/.homebridge/config.json or /root/.homebridge/config.json, or somewhere entirely different. You might want to use locate to see if there are some extraneous ones. Ideally, I think you would want it running under the pi user, so would refrain from using sudo if at all possible.

not sure what you mean by chown? chown /usr/local/lib ??

I emptied out all of the homebridge plugins and it's still somehow finding them with 'sudo homebridge', but not 'homebridge'.

hmm....

Yes, chown pi:pi /usr/local/lib/node_modules if there are mixed directory permissions on it (which happens when you install global modules with sudo), so you don't have to run with sudo in the future. Again, make sure no other users need to use it if you're going to do that.

Need to use sudo for that... you don't have permission to give yourself more permission :-)

got cha!

quick update.

I can now run homebridge without sudo and it connects in homekit, AND recognizes the new updates! (I deleted the accessory in homekit and re added it with the QR code from the non sudo homebridge)

still no luck getting the xbox's to turn on though. triple checked all the numbers. the xbox app on iphone works fine so everything seems to be talking to each other on the network elsewhere.

just found some more plugins living here: /home/pi/.nvm/versions/node

I'm pretty sure these are the ones it's actually using. is this bad? I'm trying to update to node version 10.x also. or at least 8.x. not sure if that's relevant.

Hi, do I need to manually install dependencies to get this to work?
Cheers!

@PerthSteve nope, just the global plugin install.

I still cannot, for the life of me, get this thing to work! 🤣 I completely reformatted my SD card for my pi. Reinstalled raspbian lite. Reinstalled homebridge and all plugins. Xbox sends signal but never once has it actually turned in the Xbox. Tried on 3 different xboxes triple checking all numbers were correct for each. Any ideas?? Also, Is the On/off plugin still in development?

i not understand if this plugin work only with xbox one X or if it works on xbox one S and xbox one the 1st model..
And I not understand if the siri command to "turn on xbox" work only if the xbox is in the (I do not know how to translate it correctly) "fast resume state" or if it work even if the xbox is in the "energy saving" mode...
EDIT: I'm pretty sure that works only with the power set to the "fast resume state". but asking don't cost anything...
There is noone that can clarify this to me?
thank you

@alessandrocroci This plugin was developed for the original Xbox One--I don't have an S or X model to test it on for confirmation. It will only work in the "Instant-on" power mode, otherwise, I don't believe the device is listening to the network.

@alessandrocroci This plugin definitely works on Xbox one s however can sometimes be intermittent.

@arcreative can you please have a look at this as it may help advance this plugin further in order to allow people to turn off their Xbox One game consoles through homekit. https://openxbox.org/

@arcreative is there anyway that you can have homebridge update the status on homekit if the console is turned on manually via a controller or the button on the console?

Doesn't it do that already? The Xbox responds to ping requests when it is online, so it should be very easy to implement if not already.

@TheHomekitWayFinder It should if your Xbox responds to ping... I think there was an issue with the HomeKit checking the state of the device though, since it assumes that when you switch it on that it stays on, instead of functioning more like a momentary switch. Really short on time lately, but hoping to get the more complete minimal OpenXbox on/off functionality working soon.

@arcreative I think this works for me using the wake-on-lan accessory, because each time I open the Home app it checks homebridge for status information, and the switch shows the correct state regardless of how the PC was turned on.

@arcreative thanks for your reply I find that when I turn on my Xbox via the console or controller that it doesn’t update my Xbox is set to always on and I have reserved the IP address so should update but doesn’t seem to. When I turn off the console it updates and says it’s off. Also I have been experiencing an issue where the console doesn’t always turn on and is very intermittent.

@TheHomekitWayFinder Not sure that's really something we can control. If you're coming to the same conclusion by just pinging the box with your computer, then there's not much more we can do here. I suppose one solution in the case of intermittent packet loss would be to ping the box several times and if any of them come back positive within a second, we return true, otherwise it times out and returns false.

The simple fact of the matter is that the Xbox is extremely intermittent under even the best of conditions. I was trying this out with both SmartGlass and the OpenXbox API the other day, and sometimes the Xbox just gets in a mode where it doesn't want to cooperate and has to be hard reset, started, and shut down before it responds to another wake command. The Xbox is literally the only device left in my life that needs its cord yanked on an all-too-frequent-basis.

Our code here is extremely simple, if there's anything going wrong, it's probably not our doing, nor do we have control over it, unfortunately.

Any updates here on having this turn the Xbox Off as well? It seems like homebridge-smartglass has this working a lot better.