Skip to content

Instantly share code, notes, and snippets.

@a-nicholls
Last active May 25, 2022 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a-nicholls/603ab8e80401c9a787eaad4dbcf51731 to your computer and use it in GitHub Desktop.
Save a-nicholls/603ab8e80401c9a787eaad4dbcf51731 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint - Harmony Activity to Xbox Enhancer
blueprint:
name: Harmony Activity to Xbox Enhancer
description:
<ha-icon icon="mdi:remote"></ha-icon><ha-icon icon="mdi:chevron-triple-right"></ha-icon><ha-icon icon="mdi:microsoft-xbox"></ha-icon>
Create an individual harmony remote activity for each Xbox activity you wish to
run/activate, have a separate harmony activity for playing Xbox that you can use
so if you switch to another game or go to the Home screen on the Xbox it
doesn't attempt to re-run the app or game. To determine Xbox Product ID from the Xbox -
select app/game and press <ha-icon icon="mdi:menu"></ha-icon> select Manage app, Select app/game
then press <ha-icon icon="mdi:alpha-x-circle-outline"></ha-icon> for File info. Note the OneStoreProductID.
domain: automation
input:
harmony_remote:
name: Harmony Remote Sensor
description: Harmony remote you wish to control the Xbox with
selector:
entity:
integration: harmony
domain: remote
default: remote.harmony
xbox_media_player:
name: Xbox Media Player
description: Xbox you wish to control
selector:
entity:
integration: xbox
domain: media_player
default: media_player.xbox
harmonyactivity_to_productid:
name: Activity to Xbox Product ID
description:
Harmony activity names with associated Xbox Product IDs
selector:
object:
default:
4K Bluray: 9NBLGGH4VVD4
All 4: 9WZDNCRFHWC9
Amazon Prime Video UK: 9NHRLPH6FFCT
Amazon Prime Video US: 9NBLGGH4VGD7
Apple TV app: 9MW0ZWQFH0M2
BBC iPlayer: 9PJD2MXXNZV7
BritBox: 9MXHWH8W4348
BT Sport: 9NBLGGH4RDWF
Crunchyroll: 9WZDNCRFJ15T
Disney+: 9NXQXXLFST89
HBO MAX: 9PJJ1K9DZMRS
hulu: 9WZDNCRFJ3L1
itv hub: 9WZDNCRFHZH7
kodi: 9NBLGGH4T892
Netflix: 9WZDNCRFJ3TJ
NOW TV: 9WZDNCRDM157
Plex: 9NBLGGH3ZZVF
Pluto TV: 9P9LV240KQ9R
Sling TV: 9NBLGGH4X7WP
Spotify: 9NFQ49H668TB
Tubi: 9N1SV6841F0B
TV from Sky: 9NH16ZFRCDCZ
Twitch: 9PFJP1Q9R4FK
VRV: 9NBLGGH4V9DB
Wireless Display: 9NBLGGH3ZW34
YouTube: 9NDP7KTLK7W3
xbox_media_timeout:
name: Timeout
description:
If Xbox is not ready wait for up to
selector:
number:
min: 0
max: 300
unit_of_measurement: "seconds"
mode: box
default: 60
xbox_try_after_timeout:
name: Try even if timed out
selector:
boolean:
default: true
mode: queued
max: 3
trigger:
platform: state
entity_id: !input harmony_remote
attribute: activity_starting
variables:
harmony_remote: !input harmony_remote
xbox_media_player: !input xbox_media_player
harmonyactivity_to_productid_input: !input harmonyactivity_to_productid
harmonyactivity_to_productid: "{{ harmonyactivity_to_productid_input[state_attr(harmony_remote,'current_activity') | default] | default }}"
condition: "{{ (trigger.from_state.state != 'unavailable') and (trigger.to_state != '') and (trigger.to_state.attributes.activity_starting != None) and (harmonyactivity_to_productid != '') }}"
action:
# Wait for sensor to change to on or player before continuing to execute.
- wait_template: "{{ is_state(xbox_media_player, 'on') or is_state(xbox_media_player, 'playing') }}"
timeout: !input xbox_media_timeout
continue_on_timeout: !input xbox_try_after_timeout
- service: media_player.play_media
data:
entity_id: !input xbox_media_player
media_content_type: ""
media_content_id: "{{ harmonyactivity_to_productid }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment