I am moving away from Alexa to HomePod. In the Alexa integration there was a “last called” sensor that could be used to determine which Alexa was used to fire the event/automation in HA. I’ve been trying to find a similar way to do the same with HomePod without good results. I’ve tried a few examples via ChatGPT, but the HomePods don’t seem to update “playing” when called as the script assumes. Is there a way to send which HomePod is sending the command to HA? Perhaps through a variable in Shortcuts?
- platform: template
sensors:
last_called_homepod_name:
friendly_name: "Last Called HomePod"
value_template: >
{% set homepods = states.media_player
| selectattr('entity_id', 'search', 'media_player.homepod')
| selectattr('state', 'eq', 'playing')
| sort(attribute='last_changed', reverse=True)
| list %}
{% if homepods | length > 0 %}
{{ homepods[0].name }}
{% else %}
Unknown
{% endif %}