Xbox sensor

Hi all,

Relatively new to this so I am sorry if this is obvious and I am missing something. I have the below setup for the xbox live sensor.

- platform: xbox_live
  api_key: !secret xbox_api
  xuid:
      - !secret xbox_xuid

all my other sensors work and this just doesn’t. I have checked api keys and xuids over and over with no joy, Is there any issues i am unaware of with this sensor?

Thanks

Mine hasn’t worked in some time, and didn’t work reliably when I first tried it.

That’s a shame, I was hoping to get some nice automation setup around my gaming group all being online, whats the best way to raise this issue with the plugin maintainer?

Through the issues tracker, linked from the help page.

1 Like

Mine seems to be working fine, try the below. Check over at xboxapi.com and ensure you have logged in with your Xbox Live account. Failing that, make sure that Microsoft haven’t been flagging their IP address as malicious via microsoft.com

- platform: xbox_live
  api_key: !secret xbox_api
  xuid: !secret xbox_xuid

I have copied your example and it shows now but doesn’t have any attributes, I have checked the api and it shows i have the one request but still doesn’t show anything.

Check over at XboxAPI, ensure you are logged in and check under Rate Limiting to see if you have been sending any requests and therefore using up your rate limit.

For example:

X-RateLimit-Limit: 120
X-RateLimit-Remaining: 74

If it is being used up, then likely points to an issue with your HomeAssistant frontend.

I have checked and i still have 120 of 120, i did use 1 earlier after changing the sensor to emulate your example but none have been used since.

Hmmm, not sure I can help on that. Sounds like HomeAssistant isn’t polling, hence you aren’t getting any info in the card. Any errors in the log?

no errors, just says the sensor is initialising and thats the last i see of it :confused:

I set this up last night and I have everything working. The problem I have is I use up my 120 requests 12 minutes into the hour. The component page doesn’t say anything about the request interval so I think I will have to dig through the code.

Yeah, I hit that yesterday (having finally got it working again). It looks like the default refresh rate is “a bit” short :wink:

Add a line like the following to the sensor:

scan_interval: 60

That will set it to refresh every 60 seconds. Adjust according to the number of XUID values you’re tracking.

2 Likes

What can I do with the xbox_live sensor besides understanding rather or not my account is online?

I use mine to track if the Xbox is on and being used as the main media device in the lounge.
You can also extract what app/game is being used on the Xbox and initiate automation’s based on that. Eg: if using Plex/Netflix, then dim the lights etc.

1 Like

too bad we cant get the play status from the blu-ray app :frowning:

Are you able to set automations based on the name of the game being played?
How do you set up your automations for whether it’s using netflix, etc?

You can setup a Template Sensor to extract the running application out of the Xbox API sensor.

Use the below and change “pawnynz” to whatever your Xbox Live username/sensor name is. It will create a sensor where if you are offline, it will display “Offline”, else it will display the name of the running app/game.

- platform: template
  sensors:
    xboxapi_current:
      value_template: '{% if is_state("sensor.pawnynz", "Offline") %}Offline{% else %}{{ states.sensor.pawnynz.attributes["XboxOne Full"] }}{% endif %}'
3 Likes

that’s awesome pal, thanks!

You got any sweet automations for different games or using it just as a sensor?

haha I can see how you can use this…if game = “x” then text wife “im busy”

1 Like

Ok, I feel like I’m halfway there.

At the moment, when my profile is not online it shows “Xbox: Turned Off” and when on, it shows what game or app I’m playing.

I have a few questions though.

  1. When on the dashboard, my HA displays nothing, is there a way to code it so that when no title is being played it shows “Turned On” or “Dashboard”?

  2. How do I now automate things based on what game/app is running? I’d like to dim the lights if playing bbc iplayer or netflix, and eventually when I get cool RGB lights in here I’d like to activate certain colour schemes when playing certain games.