Universal Media Player State Template

Hi All,

I’m currently having an issue with the universal media player - I’m trying to get it to display as ‘playing’ when someone is playing Xbox on the TV, I currently have Sky, AndroidTV and Xbox mapped to the UMP - Sky and Android report the play status OK, but I have no media player device for the Xbox.

I tried using a state template to force the state to show ‘playing’ when the Harmony is set to Xbox, and then look directly at the device for other sources. This template works fine in the ‘developer tools’ but when I use it in the UMP config the state is always ‘off’ regardless of source.

Here’s what I tried;

media_player:
  - platform: universal
    name: Living Room TV
    attributes:
      state: >
        {% if is_state_attr('remote.living_room', 'current_activity', 'Play Xbox One') %}
          playing
        {% elif is_state_attr('remote.living_room', 'current_activity', 'Watch Android TV')%}
          {{states('media_player.living_room_androidtv')}}
        {% elif is_state_attr('remote.living_room', 'current_activity', 'Watch Sky TV')%}
          {{states('media_player.skyq_living_room')}}
        {% else %}
          off
        {% endif %}
      source_list: remote.living_room|activity_list
      source: remote.living_room|current_activity
<snip>

Anyone know why this wouldn’t work?

Answering my own question here, but looking at it again today I realised I used ‘state’ instead of ‘state_template’ and I have it sat under attributes which it shouldn’t be!

That’s what I get for attempting to multi task :stuck_out_tongue: :man_facepalming:

Hi have a problem to write attributes of universal media player

attributes:
  state: input_boolean.stb7_state                     #1
  source_list: input_select.sources_stb7|options      #2
  volume_level: input_number.stb7_volume_level|state  #3

the lines 1 and 2 works but not the line 3

I tried whitout success

volume_level: input_number.stb7_volume_level
volume_level: input_number.stb7_volume_level.state
volume_level: {{states('input_number.stb7_volume_level')}} #error
...

Nothing works

Have you the solution ?
Thanks

Sorry it’s not something I’ve done, but it could be something to do with the actual value you have in that input number? - I think when looking at some volumes they were represented 0 - 1.0, so 0.25 was 25% volume… Maybe try some different values and see if it works.
I think the correct configuration line should just be the entity I’d though.

Hi Swifty
The problem is that I don’t know how to retrieve the state of an entity, only attributes.
If I create a dummy instruction like

volume_level: input_number.stb7_volume_level|max

this creates variable in the list of media control attributes.
but none of the lines above create this variable.

To summarize: how to write the line that allows to retrieve the state of an entity?

The solution was so simple !

volume_level: input_number.stb7_volume_level