Xbox One / Smartglass Integration

Did you add the custom component file to your home assistant custom_components directory?

You have to authenticate, and once you do, any app or game you save to your “Pins” will appear as a source. Make sure to add it to your “Pins” group: https://support.xbox.com/en-US/xbox-one/console/group-games-apps

Thanks for the reply. I am authenticated and have the apps in my “Pins” group but still don’t see them. I will have to take a close look and see if I can figure it out.

Here are the error messages I am seeing:
127.0.0.1 - - [2018-10-03 17:37:01] “GET /device/FD009FBDE2DEF712/ir HTTP/1.1” 200 7885 0.072394
127.0.0.1 - - [2018-10-03 17:37:01] “GET /auth HTTP/1.1” 200 5702 0.000751
[2018-10-03 17:37:01,884] DEBUG in connectionpool: https://eplists.xboxlive.com:443 “GET /users/xuid($$$$$$$$)/lists/PINS/XBLPins HTTP/1.1” 401 0
[2018-10-03 17:37:01,885] ERROR in app: {‘success’: False, ‘message’: ‘Download of pins failed, error: Expecting value: line 1 column 1 (char 0)’}
127.0.0.1 - - [2018-10-03 17:37:01] “GET /web/pins HTTP/1.1” 500 232 0.107554
127.0.0.1 - - [2018-10-03 17:37:01] “GET /auth HTTP/1.1” 200 5702 0.000743

Edit: I replaced my xuid in the message above.

Update: After restarting the xbox-rest-server it seems to have resolved the problem.

Yeah, there is a known bug where the pins API call doesn’t use the refreshed access tokens. I’m preparing an update that should fix this. Until then, restarting the addon should work.

Hi Hunter , thanks for the add-on .
I have a bit of a problem though and hoping you can assist. I have followed the instructions on - Hass.io Add-on: Xbox One.

However i continue to receive the following Errors .
[2018-10-05 09:07:55,596] INFO in rest_server: Starting Xbox Smartglass REST server started on 0.0.0.0:5557 [2018-10-05 09:07:55,602] DEBUG in rest_server: Setting tokenfile path to /root/.local/share/xbox/tokens.json [2018-10-05 09:07:55,603] INFO in rest_server: Trying to load & refresh tokens [2018-10-05 09:07:55,604] WARNING in rest_server: Failed to authenticate with tokenfile from /root/.local/share/xbox/tokens.json, error: [Errno 2] No such file or directory: ‘/root/.local/share/xbox/tokens.json’ [2018-10-05 09:07:57,276] DEBUG in protocol: Received DiscoverResponse from 10.0.0.16

You need to first authenticate at /auth/oauth before being able to connect unless you have anonymous: true in your config.

Version 1.1 is out which should fix known issues.

HI Hunter , I have updated the Add-On however i am getting the same error message as before. Below is the output of the device config.I have replaced the Device ID with XX as not to give any secret info out.
{“devices”:{“xxxxxxxxxxxxxx”:{“address”:“10.0.0.16”,“anonymous_connection_allowed”:true,“authenticated_users_allowed”:true,“connection_state”:“Connecting”,“console_users_allowed”:false,“device_status”:“Available”,“is_certificate_pending”:false,“liveid”:“xxxxxxxxx”,“name”:“XboxOne”,“pairing_state”:“NotPaired”,“uuid”:“xxxxxxxxx”}},“success”:true}

Please checkout https://github.com/OpenXbox/xbox-smartglass-rest-python/blob/master/FAQ.md

PS: What kind of error / behaviour are you getting? In your previous log there is no error, besides the non-existant token file?! After auth, as @hunterjm mentioned, connection should work fine. You might have to restart the addon / rest server / hass tho.

Hi
The Error i am seeing in the Log after restarting the Add-On "ERROR in app: {‘success’: False, ‘message’: ‘Console info for FD0XXXXXXXXXX is not available’} , even though the console is powered on. When i check the Home page to see if the xbox card appears it does but nothing seems to be working " Power Button , Source Selection state changes to on or off but no action on the xbox happens.

Hi .
I have managed to get the Xbox paired successfully and it’s working when selecting apps etc.
I just wanted to know is there a way to get the controls working like the bottoms on the Xbox controller and the directional buttons.

Will there be an all-in-1 Docker image available too for us running HA on docker? Would love to be able to use HA with Xbox but I’m not running hassio.

Yesterday, I managed to get this all working through hassio addons. I got my device ID after a number of restarts and attempts, put it in my yaml, tested it and it all seemed to work as expected.

Excitedly went to play around with it tonight and nothing works. The addon seems to be running fine, the auth/oath still says i’m logged in, /device shows same device ID but the media_player.xbox_one shows off (it’s on) and wouldn’t power the device on when clicked. I’ve restarted a couple of times and no dice.

Hassio addon logs shows this : https://hastebin.com/xolugiwezo.css

Just a question, who decides where this becomes a component would love to see this over there?

I have just got back into homeassistant after completing media room renovations. I would like to implement a remote component that can send arbitrary controller inputs to the xbox, such as those found on the media remote (mostly just fast forward/rewind and menu) as well as those on the xbox one controller.

This is straightforward with the smartglass rest server, but I would like to avoid redundant code regarding the initial setup of the xbox. Would it make sense to put the xbox setup related stuff in a separate component called xboxone and then have media_player.xboxone and remote.xboxone components that depend on it? This is how the appletv component handles it, I believe.

EDIT: Just implemented this via a rest_command:

  xboxone_input:
    url: "http://192.168.1.10:5557/device/<your_live_id>/{{ type }}/{{ command }}"

where type can be media or input and command can be any of the commands corresponding to those.

seems unnecessary to implement a remote component when it’s this simple with the rest server. Perhaps a mention in the official documentation will help people looking to add this functionality.

Hi @tuxuser,

Have tthe exact same problem as @rebelelephant whit homeassistant

I have follow the manual instalation guide step by step.

  • Xbox rest server instaled without problem on my homeassistant venv virtual enviroment
  • the server start itlselft via systemd
  • i can authenticate whit my xbox account and my console id shows up
  • i created the -media_player entry whit my xbox id, name and platform xboxone on my configuration.yalm
  • i copied the xbox.py on my home assistsnt custom components folder -> /home/homeassistant/.homeassitant/custom components/media_player/xboxone.py

The media player dont show up on HA, and the only info in the dev panel is “Error loading custom_components.media_player.xboxone. Make sure all dependencies are installed
16:38 custom_components/media_player/xboxone.py (ERROR)”

  • i have other custom_components loaded without problems, one of the is another media player.
    Also i did a fresh start whit another SD installing raspian and homeassitant from the scratch and only trying to install this componnet, got the exact same result

Would really like to use the component and any help is apreciated

Rename media_player/xboxone.py to xboxone/media_player.py in your custom_components folder.

Thanks a lot @jimz011

Just did that and the component still dont show (have restarted HA) l now the dev panel error is “Unable to find component media_player.xboxone
19:02 loader.py (ERROR)”

Have tried removing the media_player folder and only having the xboxone folder whit media_player.py in /custom_components whit the same result.

Any other advice?

In the newer HA your components have to have an __init__.py. This file can just be empty