Help with Alexa Media Player

I previously had some help with using Alexa Media Player to call out results of a query, i got it working thanks to the help i got but now can’t see how to utilise the last_called and the documentation i’m reading sometimes says is now deprecated.

I’m using the below automation to respond to queries, currently it’s hard-coded to respond through a particular Echo. However, I need the response to come from last_called. Can anyone help guide me along?

- id: '1234'
  alias: EV Automations
  triggers:
  - entity_id: light.alexa_virtual
    to: 'on'
    trigger: state
  conditions: []
  actions:
  - action: notify.alexa_media
    data:
      message: "{% if (state_attr('light.alexa_virtual', 'brightness') | int / 255
        * 100 ) | int == 10  %}\n  The battery is currently at {{ states('sensor.xxxxxxx_soc')
        }} percent\n{% elif (state_attr('light.alexa_virtual', 'brightness') | int
        / 255 * 100 ) | int == 20  %}\n  The electric range is {{ states('sensor.xxxxxxx_range')
        }} miles\n{% else %}\n  There is no routine set up for that value.\n{% endif
        %}"
      target: media_player.kitchen_echo
  - action: light.turn_off
    entity_id: light.alexa_virtual
  initial_state: 'on'
  mode: single

The attribute last_called hasn’t been deprecated per se, but the way it updates was changed by Amazon a while back so it isn’t as responsive or as easily usable as it used to be.

You can use the alexa_media.update_last_called action to force an update, but Amazon will send an error message if you perform requests too frequently. I don’t know what the exact allowed frequency is, but I’ve received Error: Too Many Requests on as few as 3 requests in 10 minutes.

...
  - service: alexa_media.update_last_called
    data: {}
  - delay:
      milliseconds: 500
  - service: notify.alexa_media_last_called
    data:
      message: |
        {% set b_index = (state_attr('light.alexa_virtual', 'brightness') | int / 255*100 ) | int  %}
        {% if  b_index == 10  %}
          The battery is currently at {{ states('sensor.xxxxxxx_soc')}} percent
        {% elif b_index == 20  %}
          The electric range is {{ states('sensor.xxxxxxx_range')}} miles
        {%else%} 
          There is no routine set up for that value.
        {%endif%}
....

Riiiight!

And so that’s why I’ve seen recent (ish) posts bunging in the delays, makes sense now.

And you’ve come in with the other major change (difference) I’ve seen, using the ‘service’

I think it was this area that was confusing me the most. So, now, instead of using targets we should call the service instead. Does this mean I should remove the ‘target’ line from my existing version?

B