This is an automated archive made by the Lemmit Bot.

The original was posted on /r/homeassistant by /u/maxi1134 on 2025-02-28 14:52:57+00:00.


I needed a script to enable my LLM to start Plex media playback on my Chromecasts.

After a few trials and errors. It seems to be working properly for a week now.

You should be able to adapt the ‘player_data’ template to pull the right entities.

In this case, it looks for chromecast since all my TVs entities end with that such as media_player.bedroom_chromecast

It is located under the variable declaration

variables:
  player_data:
    {% if media_player %} 
    {{integration_entities('cast') 
     | expand
     | selectattr('entity_id', 'search', 'chromecast')
     | selectattr('entity_id', 'search', media_player.split(' ') | first | lower)
     | map(attribute='entity_id') | list }}     
    {% elif area %} 
    {{ integration_entities('cast') 
     | expand
     | selectattr('entity_id', 'search', 'chromecast')
     | selectattr('entity_id', 'search', area.split(' ') | first | lower)
     | map(attribute='entity_id') | list }} 
    {% endif %}

Here is the complete script YAML

No more fumbling on your phone, now you can just ask your Assist endpoints!