Hello,
I want to trigger an automation everytime the media_title attribute of the media_player (spotify) component changes.
Couldn’t find or figure out any solution. Did anyone already have a solution or a suggestion I can try out?
Thanks in advance.
Walhalla
(Walhalla)
2
you need to set up a sensor for the specific attribute in the configuration.yaml like:
sensor:
- platform: template
sensors:
apple_tv_media_title:
value_template: "{{ states.media_player.apple_tv.attributes['media_title'] | default('Nothing playing') }}"
friendly_name: Apple TV
the “friendly_name” is optional and the " | default(‘Nothing playing’)" can be skipped if there already is a default value or you don’t need one.
after that you can create an automation with “entity_id: sensor.apple_tv_media_title” as trigger.
1 Like
Thank you Walhalla,
This actually solved it!
It’s important to use states before the component name. One of my mistakes when I tried it nearly the same way ![:man_facepalming: :man_facepalming:](https://community.home-assistant.io/images/emoji/twitter/man_facepalming.png?v=9)
mkh595
(mkh595)
4
you need to set up a sensor for the specific attribute
Is not necessary to create new sensor. See solution here: Using attribute as trigger for automation