Xbox One / Smartglass Integration

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

Thanks @Devqon, finally got it working after that.

Now the problem i have is the componet, the media player show up, but the only thing i can do is turn the xbox on, not turn it off of launch any apps. The apps that i got instaled are shown in the “source “ menu in the component, but when i execute every single one of them (or the on/off button) gives the error “error calling media_player/xxxx/. ‘btn.vol_mute‘

The detailed dev planed error is

File “/home/homeassistant/.homeassistant/custom_components/xboxone/media_player.py”, line 534, in supported_features
if not self._xboxone.volume_controls:
File “/home/homeassistant/.homeassistant/custom_components/xboxone/media_player.py”, line 122, in volume_controls
‘mute’: controls[‘buttons’][‘btn.vol_mute’][‘url’],
KeyError: ‘btn.vol_mute’

I would love to be able to add up down left right select commands. been waiting patiently for someone to figure that out :wink:

I have been trying to figure out how to send a source select command to my Xbox. For the life of me I just cant figure out the proper setup. All of the sources I am trying are pinned apps in my Xbox and are listed in my home assistant entities. I really appreciate any help you guys can offer. I have tried without quotes and with quotes ’ or ". This script format is what seems to be the correct way according to most of the documentation I have read but unfortunately doesn’t work.

xboxnetflix:
  sequence:
    - service: media_player.select_source
      data:
        entity_id: media_player.xbox_one
        source: 'Netflix'
xboxyoutube:
  sequence:
    - service: media_player.select_source
      data:
        entity_id: media_player.xbox_one
        source: 'YouTube'
xboxhulu:
  sequence:
    - service: media_player.select_source
      data:
        entity_id: media_player.xbox_one
        source: 'Hulu'

Idk why no one talk about it, but i doubt someone got launch apps/games working. Not for this component itselft but for the smartglass protocol. Try open your iOS/Android smartglass app and launch a game/app, for me (on diferent devices) does nothing on the xbox, just open the “controller” mode on the app (the thing that let you swipe and use a,b,x.y buttons)

My smart glass app pad works?