I am trying to record music playing history to our HomePods given there is no native ability within Apple’s ecosystem. I was able to do this by creating a template sensor with the following code:
sensor:
- platform: template
sensors:
kitchen_homepod_music_playing_title:
friendly_name: Kitchen HomePod Music Playing Title
entity_id:
- media_player.kitchen_homepod
value_template: "{{state_attr('media_player.kitchen_homepod', 'media_artist')}} - {{state_attr('media_player.kitchen_homepod', 'media_title')}} ({{state_attr('media_player.kitchen_homepod', 'media_album_name')}})"
Now I can see the history on my dashboard using the history card for the new entity ‘kitchen_homepod_music_playing_title’.
However, since this is my first time creating and using a template sensor I’m wondering if this was the best/most efficient way to accomplish this? I had been looking to just log the existing attribute from the HomePod device, but couldn’t figure it out.
Any thoughts from those with more experience? Am I going to run into any issues with my chosen approach? (e.g. memory/performance/etc.)
Thanks in advance!
1 post - 1 participant