Xbox


The Xbox integration allows you to control Xbox One (or newer) consoles from Home Assistant.

Home Assistant authenticates with Xbox Live through OAuth2 using the Home Assistant Cloud account linking service.

Configuration

To add the Xbox integration to your Home Assistant instance, use this My button:

Note that for the media player and remote entities to be added your Xbox will need to have remote features enabled via Settings -> Devices & connections -> Remote features (you may need to upgrade your controller firmware).

Because it uses the Home Assistant Cloud account linking service you must have either cloud: or default_config: in your configuration.yaml.

Media Player

The Xbox media player platform will create Media Player entities for each console linked to your Microsoft account. These entities will display the active app and playback controls as well as a media browser implementation, allowing you to launch any installed application.

Service play_media

Launches an application on the Xbox console using the application’s product ID. Also supports “Home” and “TV” to navigate to the dashboard or Live TV respectively.

You can find Product IDs using the Developer Tools -> Events tab and listening to the call_service event. In a new browser tab, navigate to the media browser for your console and click on an App/Game to see the product ID in the event.

Service data attribute Description
entity_id entity_id of the Xbox media player
media_content_id “Home”/“TV”/{product_id}
media_content_type Any Value

Examples:

entity_id: media_player.xboxone
media_content_type: ""
media_content_id: "Home"
entity_id: media_player.xboxone
media_content_type: ""
media_content_id: "9WZDNCRFJ3TJ" # Netflix

Remote

The Xbox remote platform will create Remote entities for each console linked to your Microsoft Account. These entities will allow you to turn on/off and send controller or text input to your console.

Service send_command

Service data attribute Optional Description
entity_id no entity_id of the Xbox remote.
command no List of the controller commands or text input to be sent.
Commands: A, B, X, Y, Up, Down, Left, Right
num_repeats yes Number of times to repeat the commands.
delay_secs yes Interval in seconds between one send and another.

Examples

entity_id: remote.xboxone_remote
command: "A"
entity_id: remote.xboxone_remote
command: "A"
num_repeats: 20
entity_id: remote.xboxone_remote
command:
  - Right
  - Right
  - A
delay_sec: 0.1

Picture Elements Card

Below is a picture elements card that can be added to a dashboard to provide an Xbox controller interface in your frontend. It utilizes the services detailed above. Replace remote.xboxone_remote and media_player.xboxone with the names of your entities and enjoy! Courtesy of @SeanPM5 and @hunterjm.

Screenshot showing Xbox Controller in a dashboard. Screenshot showing Xbox Controller in a dashboard.

type: picture-elements
image: >-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0IDQuNTY4IDMuNTY1IDAgMC03LjEzMyA2Ljk1Ni03LjA3MyAxMy40OTdhMTIuOTI2IDEyLjkyNiAwIDAgMS0yLjE2Ny03LjE2MWMwLTMuOTg3IDEuODM4LTcuNTE2IDQuNjcyLTkuOXoiLz4KICA8cGF0aCBkPSJtOTkuNzYxIDY1LjIzMmgtMS41MzY0djcuNjgyMmgxLjUzNjR2LTcuNjgyMm0zLjcxMDUgMS42NjctMS4wOTA5IDEuMDkwOWMxLjI1OTkgMS4wMTQgMS45ODk3IDIuNTQyOCAxLjk4OTcgNC4xNTYxYTUuMzc3NSA1LjM3NzUgMCAwIDEtNS4zNzc1IDUuMzc3NWMtMi45NjUzIDAtNS4zNzc1LTIuMzk2OC01LjM3NzUtNS4zNzc1IDAtMS42MDU2IDAuNzI5ODEtMy4xNDIgMS45ODItNC4xNjM3bC0xLjA4MzItMS4wODMyYy0yLjkxMTUgMi40NzM3LTMuMjY0OSA2LjgzNzEtMC43OTEyNiA5Ljc0ODcgMi40NzM3IDIuOTAzOSA2LjgzNzEgMy4yNTcyIDkuNzQ4NyAwLjc4MzU4IDEuNTUxOC0xLjMxMzYgMi40MzUyLTMuMjQ5NiAyLjQzNTItNS4yODUzIDAtMi4wMjA0LTAuODkxMTMtMy45NDEtMi40MzUyLTUuMjQ2OXoiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9Ii43NjgyMiIgc3R5bGU9InBhaW50LW9yZGVyOnN0cm9rZSBmaWxsIG1hcmtlcnMiLz4KIDwvZz4KPC9zdmc+Cg==
elements:
  - type: service-button
    title: ""
    service: remote.send_command
    service_data:
      entity_id: remote.xboxone_remote
      command: Up
    style:
      top: 45.35%
      left: 14.3%
      width: 6.2%
      height: 15%
      overflow: hidden
  - type: service-button
    title: ""
    service: remote.send_command
    service_data:
      entity_id: remote.xboxone_remote
      command: Down
    style:
      top: 74.7%
      left: 14.3%
      width: 6.2%
      height: 15%
      overflow: hidden
  - type: service-button
    title: ""
    service: remote.send_command
    service_data:
      entity_id: remote.xboxone_remote
      command: Left
    style:
      top: 60%
      left: 8.05%
      height: 14.4%
      width: 6.4%
      overflow: hidden
  - type: service-button
    title: ""
    service: remote.send_command
    service_data:
      entity_id: remote.xboxone_remote
      command: Right
    style:
      top: 60%
      left: 20.65%
      height: 14.4%
      width: 6.4%
      overflow: hidden
  - type: service-button
    title: ""
    service: remote.send_command
    service_data:
      entity_id: remote.xboxone_remote
      command: "A"
    style:
      top: 82.5%
      left: 80.05%
      width: 10.5%
      height: 24.4%
      border-radius: 100%
      overflow: hidden
  - type: service-button
    title: ""
    service: remote.send_command
    service_data:
      entity_id: remote.xboxone_remote
      command: "X"
    style:
      top: 60.0%
      left: 70.6%
      width: 10.5%
      height: 24.4%
      border-radius: 100%
      overflow: hidden
  - type: service-button
    title: ""
    service: remote.send_command
    service_data:
      entity_id: remote.xboxone_remote
      command: "B"
    style:
      top: 60.0%
      left: 89.5%
      width: 10.5%
      height: 24.4%
      border-radius: 100%
      overflow: hidden
  - type: service-button
    title: ""
    service: remote.send_command
    service_data:
      entity_id: remote.xboxone_remote
      command: "Y"
    style:
      top: 37.9%
      left: 80.05%
      width: 10.5%
      height: 24.4%
      border-radius: 100%
      overflow: hidden
  - type: service-button
    title: ""
    service: remote.toggle
    service_data:
      entity_id: remote.xboxone_remote
    style:
      top: 80.2%
      left: 47.2%
      width: 7%
      height: 16%
      border-radius: 100%
      overflow: hidden
  - type: service-button
    title: ""
    service: media_player.play_media
    service_data:
      entity_id: media_player.xboxone
      media_content_type: ""
      media_content_id: "Home"
    style:
      top: 22.2%
      left: 47.2%
      width: 13.4%
      height: 31.2%
      border-radius: 100%
      overflow: hidden

Binary Sensor

The Xbox binary sensor platform automatically keeps track of your “Favorite friends”. In your friends list, select Change friendship -> Favorite to have that person automatically pulled into Home Assistant.

4 binary sensors are added, 3 of which are disabled by default. They can be enabled in the “Xbox Live” service on the devices page.

Entity ID Default Description
binary_sensor.{gamertag} Enabled Shows the online status of your friend.
binary_sensor.{gamertag}_in_game Disabled Shows if your friend is currently playing a game.
binary_sensor.{gamertag}_in_party Disabled Shows if your friend is currently in a party.
binary_sensor.{gamertag}_in_multiplayer Disabled Shows if your friend is currently in a multiplayer session.

Sensor

Just like the binary sensors, the Xbox sensor platform automatically keeps track of your “Favorite friends”.

4 sensors are added, all of which are disabled by default. They can be enabled in the “Xbox Live” service on the devices page.

Entity ID Default Description
sensor.{gamertag}_status Disabled Shows the text status of your friend as it appears in your friends list.
sensor.{gamertag}_gamer_score Disabled Shows your friend’s gamer score.
sensor.{gamertag}_account_tier Disabled Shows your friend’s Xbox Live account tier (Gold or Silver).
sensor.{gamertag}_gold_tenure Disabled Shows how long your friend has had Xbox Live Gold.

Media Source

The Xbox media source platform allows you to use the Media Browser panel to view both your own, and community, gameclips or screenshots for games that you have installed on any of your consoles. As with any other media source integration, you are also able to send these clips to supported media players like Chromecast.

It can take up to a couple of days for newly installed applications to appear in the media browser.

Manual Configuration

These steps are not required, nor will they be supported if issues are encountered.

If you prefer not to use the Home Assistant account linking service, you may manually configure a local implementation if your instance is exposed externally over HTTPS using the following steps:

  • Register a new application in Azure AD
    • Name your app
    • Select “Personal Microsoft accounts only” under supported account types
    • For Redirect URI, add: https://my.home-assistant.io/redirect/oauth
  • Copy your Application (client) ID for later use
  • On the App Page, navigate to “Certificates & secrets”
    • Generate a new client secret and save for later use

You may then add the credentials to Application Credentials and then setup the integration.