Can anyone offer some advice? I’m attempting to get an echo dot announce the track details when a new song plays on my Sonos (called: media_player.unnamed_room). I have added the following to the Yaml, but it doesn’t seem to be working. Maybe it’s a formatting issue? I’m grateful for any help.
- alias: Announce Bathroom Sonos Songs
trigger:
platform: state
entity_id: media_player.unnamed_room
attribute: media_title
action:
service: notify.alexa_media
data:
target:
- media_player.echo_dot
message: Now testing announcement on the bathroom Sonos {{
states('media_player.unnamed_room').attributes.media_artist }} - {{
states('media_player.unnamed_room').attributes.media_title }}
I’m seeing this error in the logs
Logger: homeassistant.components.automation.announce_bathroom_sonos_songs
Source: components/automation/init.py:566
Integration: Automation (documentation, issues)
First occurred: 12:50:30 PM (2 occurrences)
Last logged: 1:02:12 PM
Error while executing automation automation.announce_bathroom_sonos_songs: Error rendering data template: UndefinedError: ‘str object’ has no attribute ‘attributes’