Automation not starting when attribute gets changed

I want to run the automation every time the entity_picture attribute gets changed (playing a new song) but I can’t manage to make it work. Below is my automation:

alias: Spotify Lights
description: ""
trigger:
  - platform: state
    entity_id:
      - media_player.spotify_arvinte
    attribute: entity_picture
condition:
  - condition: sun
    after: sunset
action:
  - service: color_extractor.turn_on
    data_template:
      color_extract_url: >-
        http://<ip_address>{{
        states.media_player.spotify_arvinte.attributes.entity_picture}}
      entity_id: light.sufragerie
      brightness_pct: 1
      transition: 5
mode: restart

Edit: The automation itself is working, but it doesn’t get triggered when the attribute is changed.

Are you sure that the automation is definitely not running? Because having a quick look at the docs -
they are using:

color_extract_url: "{{ states.media_player.chromecast.attributes.entity_picture }}"

they don’t have the Home Assistant base IP and port etc, so I assume that is all included in the entity_picture URL?

And in fact checking on my own Bedroom smart clock -

entity_picture_local: /api/media_player_proxy/media_player.bedroom_clock?token=f35634d81fb5a15f3e80c20f46b1b3e7fde7f293a9bcb409013c9a6bb969090e&cache=25a80a3c951c9fd0
entity_picture: https://i.scdn.co/image/ab67616d0000b273587b26d49596162397b29ec8

entity_picture definitely has a full URL - you don’t want to be adding the Home Assistant IP address in front of it.

The automation itself is working, but it doesn’t get triggered when the attribute is changed.

Going step by step…

Did you try the trigger without the condition and see if this automation triggers ?

If not, try:

trigger:
  - platform: state
    entity_id: media_player.spotify_arvinte
    attribute: entity_picture