Creating a Blueprint Selector That Lists Media Player Sources

Hi all,

I’m attempting my first Blueprint for home assistant and I’ve got the basics sorted. However, I’m struggling to find the correct options for an input selector that will dynamically list the available sources for my media player entity.

I’ve tried the attribute selector type and the template selector but I’m unable to access the source list.

My current code is

      name: Shield Input Source
      description: Select the source input that you want the Shield to switch to.
          {{ state_attr('media_player.android_tv_192_168_1_41', 'source_list') }}

This code errors when trying to import the Blueprint.

while parsing a flow mapping in "<unicode string>", line 11, column 12: {{ state_attr('media_player.andro ... ^ expected ',' or '}', but got '<scalar>' in "<unicode string>", line 11, column 78: ... _tv_192_168_1_41', 'source_list') }}

The full blueprint can be found here


This is straight up a template question and nothing to do with a blueprint.
It is having problems with the attribute in the template.

2 things.

For troubleshooting, replace the !input call with the actual template in all 4 places in action to make sure that code will work there. I expect it will not work.

Figure out exactly what template will provide you the actual value that you need in that place. Trial & error and the help from a template expert should get you thru that. I don’t know what is supposed to be there or what exactly it is complaining about. It is probably looking for a cast to a list somewhere but I’m not sure.

1 Like

Thanks for the advice, it’s the first time I’ve tried with blueprints so I apologise if the question is in the wrong area. I’ll give this a go and post over there if I’m still struggling.