Xboxlive not functional anymore?

Hi,

Selfisolation made me want to brush up my Xbox skills (and auch that hurts…).

Which made me notice my HA xboxlive sensor isn’t working anymore. I’ve checked the credentials and they allow me to login just fine on xboxlive.com.

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

had this before:

sensor:
  - platform: xbox_live
    api_key: !secret xbox_api
    xuid: !secret xbox_xuid
    scan_interval: 60

but I noticed the scan_interval options wasn’t on the integration documentation, and it states I need a list, so, though my previous config worked until recently, Ive changed it to what’s prescribed.

No joy however, the log keeps asking me for a fresh login. which of course I have just done before restart.

2020-04-20 14:35:50 ERROR (SyncWorker_19) [homeassistant.components.xbox_live.sensor] Can't setup XboxAPI connection. Check your account or api key on xboxapi.com. Code: 401 Description: A fresh login is required to gain a new token from Microsoft 

since this is a Microsoft notice, Ive even re-loggedin on the MS account for this XBOX and user.
Anyone else seeing this, and maybe have a solution?

I dropped the component awhile ago

there’s no real alternative is there?
btw since this is no CC but core, shouldn’t it be maintained somehow, to at least a functional state… couldn’t find a bug report on Github, so hoped fellow members here would know what I was doing wrong.

Integrations are maintained by the code owner. If the code owner is MIA the issue will get assigned to someone at some point.

I dropped it because of this issue but also because I never used it. Pretty much a waste of time for me. I bought a roku and that implementation works 100% better and doesn’t have a api cost.

can one track the Xbox via a roku then? and see which game is on, track more or less like this:

      xboxapi_current:
        value_template: >
          {% if states.sensor.myname %}
            {% if is_state('sensor.myname','Offline') %} Offline
            {% elif is_state('sensor.myname','unknown') %} Unknown
            {% else %} {{state_attr('sensor.myname','XboxOne Full')}}
            {% endif %}
          {% else %} n/a
          {% endif %}
        icon_template: >
          {% set gamertag = 'sensor.myname' %}
          {% set state = states('sensor.xboxapi_current') %}
          {% if gamertag %}
            {% if is_state(gamertag, 'Online') %}
              {% set state = states('sensor.xboxapi_current') %}
              {% set icon = {'Home':'mdi:xbox-controller-menu',
                             'Store':'mdi:shopping',
                             'Netflix':'mdi:netflix',
                             'Plex for Xbox One':'mdi:plex',
                             "The Elder Scrolls V: Skyrim Special Edition":'mdi:gamepad',
                             "Assassin's Creed® Odyssey":'mdi:xbox',
                             'The Sims™ 4':'mdi:gamepad-down',
                             'Rise of the Tomb Raider':'mdi:grave-stone'} %}
              {{icon[state] if state in icon else 'mdi:xbox-controller'}}
            {% elif is_state(gamertag, 'Offline') %} mdi:xbox-controller-off
            {% else %} mdi:toggle-switch-off
            {% endif %}
          {% else %} mdi:message-bulleted-off
          {% endif %}

I should have clarified. Everything I wanted to track in xbox is available in the roku. I.E. I only used my xbox account to track netflix, amazon-prime, hbo, etc. Never used it to track anything else, so it’s probably not the same as your situtation.

The whole xboxapi site has moved. Has the component been working since then? Or is it a simple change in the code?

yes it was moved, but on the new site one can still login. If I do so and check the documentation page with the live json details, I do see an error:

{"xuid":25redacted1,"gamerTag":null,"gamertag":null}

I’ve explicitly logged out and back in on my Xbox, my Microsoft account and the Xboxlive page…

I fixed this locally by editing the python module for xboxapi.

For me this was located in /home/pi/homeassistant/lib/python3.7/site-packages/xboxapi/xbox_api.py
(I’m running Core in a python virtual environment)

I just needed to switch the old API URL for the new one. i.e. find all mentions of xboxapi.com and replace with xapi.us

Save and restart homeassistant and it’s working as expected.

Ok great! If that simple , would you create a PR in the core integration to do so please?

Yep, I’ll do that as soon as I get a chance.

Cool, I’ve had a quick look in the core integrations but xbox_live/sensor.py doesn’t have this, and imports xboxapi from xbox_api…
so, not an easy PR to do for me I am afraid.

** BUMP! Any coding geniuses out there to fix the issue? And make the XBOX API integration useful again?

P.S. I dont have a Roku

It looks like the xbox_api library that HA uses has been updated a few days ago: https://github.com/mKeRix/xboxapi-python/commit/473f4cccfd3580e3d6891284df232595ae88b715

HA now just needs to use the latest version of xbox_api (2.0.1). Does anyone have any idea how to get this done?

I’ve updated to 113.2 and Xbox live is back in business. No need to do anything special

Weird. I’m on 113.3 (previously 113.2) and it’s still broken for me.

just checked again for you:

it is still annoying though, and keeps logging out, so if you need the sensor, be sure to login to xbox api and then restart your HA instance.

Thanks for the confirmation. My logs have mention of the xapi.us URL, so it looks like something has been updated somewhere.

I’ve just updated to 114.4 and it no longer works for me.

Error - * Can’t get user profile xxxxxxxxxxxxxxxxx. Error Code: unknown Description: unknown

Anyone got any tips?

did you try to login at https://xboxapi.com which resolves to https://xapi.us ?