Probably, but it can depend on whether or not the integration provides that data in a way you can access it.
This is a simple version that I use with Voice PE and Music Assistant:
alias: Sentence Query Track and Artist
description: ""
triggers:
- trigger: conversation
command:
- "[who| (what|which) [track|song|artist]] is this"
- "(name|identify) this [track|song|artist]"
conditions: []
actions:
- set_conversation_response: >-
{% set media_players = area_entities(area_id(trigger.device_id))
| select('match', 'media_player.') | select('is_state', 'playing')
| expand | selectattr('attributes.media_artist', 'defined') | first %}
This is {{media_players.attributes.media_title}} by {{media_players.attributes.media_artist}}
mode: single
More robust version
This version gets all the media player speakers that are playing. If there are multiple, it then tries to get the closest one by comparing the device entities, then area entities, then floor entities. It also includes some randomization of the returned phrase, for fun.
alias: Sentence Query Track and Artist (robust)
description: ""
triggers:
- trigger: conversation
command:
- "[who| (what|which) [track|song|artist]] is this"
- (name|identify) this [track|song|artist]
actions:
- set_conversation_response: "{{message}}"
variables:
are_playing: >-
{{ states.media_player | selectattr('state','eq','playing') | selectattr('attributes.media_artist', 'defined')
| selectattr('attributes.device_class', 'eq', 'speaker') | map(attribute='entity_id') | list }}
active: "{{ are_playing | count }}"
message: |-
{%- if not active|bool %}
There are no near by active speakers.
{%- else %}
{%- if active == 1 %}
{%- set player = are_playing[0] %}
{%- else %}
{%- set player = (intersect(are_playing,device_entities(trigger.device_id))
or intersect(are_playing,area_entities(area_id(trigger.device_id)))
or intersect(are_playing,floor_entities(floor_id(trigger.device_id)))) %}
{% set player = player|first %}
{%- endif %}
{%- set preface_opt = ['This ' ~ ['','track', 'song']|random,'The current '~['track', 'song']|random,
'Whats ' ~['','currently ']|random ~'playing']|random %}
{{-preface_opt ~ ' is '}}{{state_attr(player, 'media_title')}} by {{state_attr(player, 'media_artist')}}
{%- endif %}
mode: single
IIRC, this specific example using the VPE requires you to have Music Assistant create a media_player entity, because the media_player entity that ESPHome creates for the device doesn’t have the data.