Xbox one sensor

Hi, I’ve only been playing with home assistant over the last day or 2 and had a lot of success in presence detection, google home integration and IR/RF device control via broadlink. but now i’ve hit an issue with my Xbox one.

I have sensors setup so i know the state of my dumb smart TV and 5.1 system using ping sensor every 2 seconds and dropped the consider_home to 3 seconds. on them devices.
I know this probably seems a little aggressive but i don’t want long delays between turning my TV on and say an automation kicking in for my lights and my RF fireplace turning on.

I know there’s an Xbox live component but this assumes an account logs in and unless you pay for it you only get 60 requests an hour that’s 1 per minute assuming you only have one account logged in.

Ping or nmap to the xbox is out the question because of the false positives with the power mode set to instant on.

I’m just wondering if anyone else out there has the same issue or has come up with another way to detect the power state relatively quickly on their xbox one?

Perhaps you could monitor its power draw with a smart switch, like this one. You could probably specify a very short update interval, or perhaps have it update based on a spike in power (e.g. on 20w changes).

1 Like

You know that’s not a bad call thanks. I’ll probably look at wiring one of the sonoff Pow’s in though. just because there a lot cheaper.
http://sonoff.itead.cc/en/products/sonoff/sonoff-pow.
I’ll report back in a few weeks in case it helps anyone else.

Thanks again

I don’t get your question… you already know if your TV is on with the Ping component, and you want to know if your XBox is on too? Don’t you turn always the TV on while using XBox? Or you do want different scenarios if you are watching TV or playing?

You could always buy a Logitech Harmony hub. Using its activity format, HA can easily determine if you’re just watching TV or if you’re playing Xbox. Not necessarily the cheapest solution, but it works very well.

Nice! I hope you can get the reaction time you’re aiming for. Might be tough with either the aeotec or sonoff, but I can’t think of a better way, and there’s a good chance it will be speedy!

@HeffeD Im not sure what i would get from a Harmony hub over the Broadlink RM Pro? If i always use HA to turn the xbox on then both would give me the correct state the issue is it’s too easy to hit the on button on a controller.

@Dolores defanity be significantly reduced from what it would be from xboxapi and wont need an account sign in on the xbox

@namadori i wanted them separate so i didn’t have to have everything on at once but for now
I’ve had a bit more of a play this morning and created a template switch, which assumes the xbox is on if the TV and 5.1 are turned on. Im now using the xbox ir blaster to turn on the TV & 5.1 making it a safe assumption.
downside is i have to turn on the xbox regardless of what TV input is in use

The solution I’m using locally is to listen to SSDP announcements from the device, the xbox one s sends an “alive” message almost immediately after turning it on and a “goodbye” when it’s shutting down so there is no polling involved. I will try to find some time this weekend to make it configurable and user-friendly enough to share for testing at least.

how would you do this please? I have a Harmony Elite and hub and struggling how best to use it :slight_smile:

If the Broadlink can tell you the state of your device, then I guess I’m confused why you’re asking for methods to tell the state. With the Harmony component, you don’t need to turn a device on through HA to be able to determine the state. Turning on an activity using the remote will still update the state to HA.

@MarkR, Are you using the Harmony component? If so, it will automatically poll your hub (or multiple hubs) state by default. So if you’re watching TV, Home Assistant is already aware of this. The component’s documentation shows some examples to get you started. Like how to display the current activity on the front end, or how to trigger a switch if a certain activity is running. There are also a lot of useful posts here on the forum of how people are automating with their hubs. If you search for Harmony and Input Select, you will find examples of a nice way to switch activities through HA.

@teprrr that would be awesome thanks. Would be very interested to see how that works.

No its just an IR blaster so if you always turned on the device from HA then you get the state, however with the xbox its easier to use the controller. I don’t know much about the Harmony hub but i assume it’s the same issue. especially reading this.

Disabling the auto power off feature
Xbox One has a power management feature that will turn off your console after a period of inactivity. We recommend Harmony always be used to power on and off your devices and therefore this power management feature should be disabled.

Learn more about how to change the power settings on your Xbox One console.

from…

Yeah, in that instance, you’re going to get out of sync. The Harmony isn’t going to know if you’ve manually turned a device on or off. (or obviously, if a device powers itself off) I actually do think it’s easier to turn off the Xbox with Harmony than from the controller because it’s only a single button press on the remote.

yeah one press is better but i’ve got most of it working with google home very well so no remote :slight_smile: the whole point of a sensor for the xbox is because its too easy to turn the xbox on with the remote resulting in the sync issues you mention. especially with wife and kids.

https://github.com/rytilahti/homeassistant-binarysensor-upnp has now the code I’m using locally myself with short introduction how to get started. It is not very complete and there is no polling to keep the states synchronized (so if it never receives the goodbyes it will happily think the device is still on, and it assumes on homeassistant that the device is turned off before it receives the initial alive messages).

edit: just experimented a bit. My xbox will sends alives every 15 mins and my soundbar every 5 mins, the sensor could also simply request an update on startup (the code is there, but isn’t working currently, some socket-level problems :/)

1 Like

That is awesome on initial testing its working flawsley and so quick to update. Thank you
An update on startup would be cool. Unfortunately i currently don’t understand much python and new to HA but ill have a poke around after mothers day.

1 Like

checking if the xbox is online only requires the device_tracker doesn’t it?

ive made myself a little xbox-package with all kinds of other sensor feedback, but checking online or offline doesnt need that.

I suggest using the Xboxlive sensor and then creating a template to check if the xbox is ‘Online’ or ‘Offline’ depending on what is running on the Xbox.

Details here

This also provides you with more flexibility to do things depending on the state of the Xbox.